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.esofthead.mycollab.module.crm.view.activity.ActivitySearchPanel.java

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true)
            .withMargin(new MarginInfo(true, false, true, false));
    layout.setSizeUndefined();//from   www .  ja  va  2 s  .  c  o  m
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    final Label searchtitle = new CrmViewHeader(CrmTypeConstants.ACTIVITY, "Events");
    searchtitle.setStyleName(Reindeer.LABEL_H2);

    layout.with(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT).expand(searchtitle);

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)
            || AppContext.canWrite(RolePermissionCollections.CRM_MEETING));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.setCaption("New Task");
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null));
        }
    });

    final VerticalLayout btnControlsLayout = new VerticalLayout();
    controlsBtn.setContent(btnControlsLayout);

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

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            controlsBtn.setPopupVisible(false);
            EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null));
        }
    });
    createMeetingBtn.setStyleName("link");
    btnControlsLayout.addComponent(createMeetingBtn);
    createMeetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING));
    final Button createCallBtn = new Button("New Call", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            controlsBtn.setPopupVisible(false);
            EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null));
        }
    });
    createCallBtn.setStyleName("link");
    createCallBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL));
    btnControlsLayout.addComponent(createCallBtn);
    layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);

    ButtonGroup viewSwitcher = new ButtonGroup();

    Button calendarViewBtn = new Button("Calendar", new Button.ClickListener() {
        private static final long serialVersionUID = -793215433929884575L;

        @Override
        public void buttonClick(ClickEvent evt) {
            EventBusFactory.getInstance().post(new ActivityEvent.GotoCalendar(this, null));
        }
    });
    calendarViewBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    viewSwitcher.addButton(calendarViewBtn);

    Button activityListBtn = new Button("Activitities");
    activityListBtn.setStyleName("selected");
    activityListBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    viewSwitcher.addButton(activityListBtn);

    layout.with(viewSwitcher).withAlign(viewSwitcher, Alignment.MIDDLE_RIGHT);

    return layout;
}

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

License:Open Source License

public CallListDashlet() {
    super("My Calls", new VerticalLayout());

    tableItem = new CallTableDisplay(new TableViewField(null, "isClosed", UIConstants.TABLE_CONTROL_WIDTH),
            Arrays.asList(//from ww  w.  ja  v a2s. co m
                    new TableViewField(CallI18nEnum.FORM_SUBJECT, "subject", UIConstants.TABLE_X_LABEL_WIDTH),
                    new TableViewField(TaskI18nEnum.FORM_START_DATE, "startdate",
                            UIConstants.TABLE_DATE_TIME_WIDTH),
                    new TableViewField(ActivityI18nEnum.FORM_STATUS, "status",
                            UIConstants.TABLE_S_LABEL_WIDTH)));

    tableItem.addTableListener(new TableClickListener() {

        @Override
        public void itemClick(final TableClickEvent event) {
            final SimpleCall call = (SimpleCall) event.getData();
            if ("isClosed".equals(event.getFieldName())) {
                call.setIsclosed(true);
                final CallService callService = ApplicationContextUtil.getSpringBean(CallService.class);
                callService.updateWithSession(call, AppContext.getUsername());
                display();
            }
        }
    });
    bodyContent.addComponent(tableItem);

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

        @Override
        public void buttonClick(ClickEvent event) {

        }
    });
    customizeViewBtn.setIcon(FontAwesome.ADJUST);
    customizeViewBtn.setDescription("Layout Options");
    customizeViewBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);

    this.addHeaderElement(customizeViewBtn);
}

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

License:Open Source License

public MeetingListDashlet() {
    super("My Meetings", new VerticalLayout());

    tableItem = new MeetingTableDisplay(Arrays.asList(
            new TableViewField(MeetingI18nEnum.FORM_SUBJECT, "subject", UIConstants.TABLE_X_LABEL_WIDTH),
            new TableViewField(TaskI18nEnum.FORM_START_DATE, "startdate", UIConstants.TABLE_DATE_TIME_WIDTH),
            new TableViewField(ActivityI18nEnum.FORM_STATUS, "status", UIConstants.TABLE_S_LABEL_WIDTH)));

    bodyContent.addComponent(tableItem);

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

        @Override/*  ww w  . j  av a2  s .c  om*/
        public void buttonClick(ClickEvent event) {

        }
    });
    customizeViewBtn.setIcon(FontAwesome.ADJUST);
    customizeViewBtn.setDescription("Layout Options");
    customizeViewBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);

    this.addHeaderElement(customizeViewBtn);
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from ww  w .ja va  2s . com*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_ACCOUNT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing accounts", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final CampaignAccountSelectionWindow accountsWindow = new CampaignAccountSelectionWindow(
                    CampaignAccountListComp.this);
            final AccountSearchCriteria criteria = new AccountSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(accountsWindow);
            accountsWindow.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.campaign.CampaignAccountSelectionWindow.java

License:Open Source License

@Override
protected void initUI() {
    tableItem = new AccountTableDisplay(AccountTableFieldDef.selected,
            Arrays.asList(AccountTableFieldDef.accountname, AccountTableFieldDef.phoneoffice,
                    AccountTableFieldDef.email, AccountTableFieldDef.city));

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

        @Override//from  ww w.j  a v  a 2  s  . com
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });
    selectBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    AccountSimpleSearchPanel accountSimpleSearchPanel = new AccountSimpleSearchPanel();
    accountSimpleSearchPanel.addSearchHandler(new SearchHandler<AccountSearchCriteria>() {

        @Override
        public void onSearch(AccountSearchCriteria criteria) {
            tableItem.setSearchCriteria(criteria);
        }

    });

    this.bodyContent.addComponent(accountSimpleSearchPanel);
    this.bodyContent.addComponent(selectBtn);
    this.bodyContent.addComponent(tableItem);
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from w  w  w.java2s . c  o m*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = -5166203461087915517L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() {
        private static final long serialVersionUID = -4257729842567787799L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final CampaignContactSelectionWindow contactsWindow = new CampaignContactSelectionWindow(
                    CampaignContactListComp.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.campaign.CampaignContactSelectionWindow.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("Select", new Button.ClickListener() {

        @Override/*  w  w  w.  j  a  v  a  2s  . c  o  m*/
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });
    selectBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    ContactSimpleSearchPanel contactSimpleSearchPanel = new ContactSimpleSearchPanel();
    contactSimpleSearchPanel.addSearchHandler(new SearchHandler<ContactSearchCriteria>() {

        @Override
        public void onSearch(ContactSearchCriteria criteria) {
            tableItem.setSearchCriteria(criteria);
        }

    });

    this.bodyContent.addComponent(contactSimpleSearchPanel);
    this.bodyContent.addComponent(selectBtn);
    this.bodyContent.addComponent(tableItem);
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from   w ww .jav a2s.co m*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final CampaignLeadSelectionWindow leadsWindow = new CampaignLeadSelectionWindow(
                    CampaignLeadListComp.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.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.campaign.CampaignLeadSelectionWindow.java

License:Open Source License

@Override
protected void initUI() {
    tableItem = new LeadTableDisplay(LeadTableFieldDef.selected, Arrays.asList(LeadTableFieldDef.name,
            LeadTableFieldDef.status, LeadTableFieldDef.email, LeadTableFieldDef.phoneoffice));

    Button selectBtn = new Button("Select", new Button.ClickListener() {

        @Override/*from w w  w  .j  a  v a 2 s  . co m*/
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });
    selectBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    LeadSimpleSearchPanel leadSimpleSearchPanel = new LeadSimpleSearchPanel();
    leadSimpleSearchPanel.addSearchHandler(new SearchHandler<LeadSearchCriteria>() {

        @Override
        public void onSearch(LeadSearchCriteria criteria) {
            tableItem.setSearchCriteria(criteria);
        }

    });

    this.bodyContent.addComponent(leadSimpleSearchPanel);
    this.bodyContent.addComponent(selectBtn);
    this.bodyContent.addComponent(tableItem);
}

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

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true)
            .withMargin(new MarginInfo(true, false, true, false)).withStyleName(UIConstants.HEADER_VIEW);

    final Label searchtitle = new CrmViewHeader(CrmTypeConstants.CAMPAIGN,
            AppContext.getMessage(CampaignI18nEnum.VIEW_LIST_TITLE));
    searchtitle.setStyleName(UIConstants.HEADER_TEXT);

    layout.with(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT).expand(searchtitle);

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

                @Override//  w  w  w .j av a  2s.com
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CampaignEvent.GotoAdd(this, null));

                }
            });
    createAccountBtn.setIcon(FontAwesome.PLUS);
    createAccountBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN));
    layout.with(createAccountBtn).withAlign(createAccountBtn, Alignment.MIDDLE_RIGHT);
    return layout;
}