List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:com.esofthead.mycollab.module.crm.view.account.AccountSelectionField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); accountName.setNullRepresentation(""); accountName.setEnabled(true);/*from w w w . j a va2 s. com*/ accountName.setWidth("100%"); Button browseBtn = new Button(null, FontAwesome.ELLIPSIS_H); browseBtn.addStyleName(UIConstants.THEME_GRAY_LINK); browseBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); browseBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { AccountSelectionWindow accountWindow = new AccountSelectionWindow(AccountSelectionField.this); UI.getCurrent().addWindow(accountWindow); accountWindow.show(); } }); Button clearBtn = new Button(null, FontAwesome.TRASH_O); clearBtn.addStyleName(UIConstants.THEME_GRAY_LINK); clearBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); clearBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { clearValue(); } }); layout.with(accountName, browseBtn, clearBtn).expand(accountName); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityCalendarViewImpl.java
License:Open Source License
private void initContent() { MHorizontalLayout contentWrapper = new MHorizontalLayout().withSpacing(false).withWidth("100%"); this.addComponent(contentWrapper); /* Content cheat */ MVerticalLayout mainContent = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true)) .withWidth("100%").withStyleName("readview-layout"); contentWrapper.with(mainContent).expand(mainContent); MVerticalLayout rightColumn = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("250px"); rightColumn.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); contentWrapper.addComponent(rightColumn); MHorizontalLayout actionPanel = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW); actionPanel.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new CrmViewHeader(CrmTypeConstants.ACTIVITY, "Calendar"); headerText.setStyleName(UIConstants.HEADER_TEXT); actionPanel.with(headerText).expand(headerText); mainContent.addComponent(actionPanel); this.dateHdr = new Label(); this.dateHdr.setSizeUndefined(); this.dateHdr.setStyleName("h2"); mainContent.addComponent(this.dateHdr); mainContent.setComponentAlignment(this.dateHdr, Alignment.MIDDLE_CENTER); toggleViewBtn = new PopupButton("Monthly"); toggleViewBtn.setWidth("200px"); toggleViewBtn.addStyleName("calendar-view-switcher"); MVerticalLayout popupLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)) .withWidth("190px"); monthViewBtn = new Button("Monthly", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w . ja v a 2s .com*/ public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(monthViewBtn.getCaption()); calendarComponent.switchToMonthView(new Date(), true); datePicker.selectDate(new Date()); monthViewBtn.addStyleName("selected-style"); initLabelCaption(); } }); monthViewBtn.setStyleName("link"); popupLayout.addComponent(monthViewBtn); weekViewBtn = new Button("Weekly", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(weekViewBtn.getCaption()); calendarComponent.switchToWeekView(new Date()); datePicker.selectWeek(new Date()); } }); weekViewBtn.setStyleName("link"); popupLayout.addComponent(weekViewBtn); dailyViewBtn = new Button("Daily", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(dailyViewBtn.getCaption()); Date currentDate = new Date(); datePicker.selectDate(currentDate); calendarComponent.switchToDateView(currentDate); } }); dailyViewBtn.setStyleName("link"); popupLayout.addComponent(dailyViewBtn); toggleViewBtn.setContent(popupLayout); CssLayout toggleBtnWrap = new CssLayout(); toggleBtnWrap.setStyleName("switcher-wrap"); toggleBtnWrap.addComponent(toggleViewBtn); rightColumn.addComponent(toggleBtnWrap); rightColumn.setComponentAlignment(toggleBtnWrap, Alignment.MIDDLE_CENTER); rightColumn.addComponent(this.datePicker); initLabelCaption(); addCalendarEvent(); actionPanel.addComponent(calendarActionBtn); actionPanel.setComponentAlignment(calendarActionBtn, Alignment.MIDDLE_RIGHT); VerticalLayout actionBtnLayout = new VerticalLayout(); actionBtnLayout.setMargin(true); actionBtnLayout.setSpacing(true); actionBtnLayout.setWidth("150px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { calendarActionBtn.setPopupVisible(false); String caption = event.getButton().getCaption(); if (caption.equals("New Task")) { EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null)); } else if (caption.equals("New Call")) { EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null)); } else if (caption.equals("New Event")) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null)); } } }; ButtonLink todoBtn = new ButtonLink("New Task", listener); actionBtnLayout.addComponent(todoBtn); todoBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)); todoBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); Button callBtn = new ButtonLink("New Call", listener); actionBtnLayout.addComponent(callBtn); callBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)); callBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); ButtonLink meetingBtn = new ButtonLink("New Meeting", listener); actionBtnLayout.addComponent(meetingBtn); meetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)); meetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); calendarActionBtn.setContent(actionBtnLayout); ButtonGroup viewSwitcher = new ButtonGroup(); Button calendarViewBtn = new Button("Calendar"); calendarViewBtn.setStyleName("selected"); calendarViewBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(calendarViewBtn); Button activityListBtn = new Button("Activities", new Button.ClickListener() { private static final long serialVersionUID = 2156576556541398934L; @Override public void buttonClick(ClickEvent evt) { ActivitySearchCriteria criteria = new ActivitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); EventBusFactory.getInstance().post(new ActivityEvent.GotoTodoList(this, null)); } }); activityListBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(activityListBtn); actionPanel.addComponent(viewSwitcher); actionPanel.setComponentAlignment(viewSwitcher, Alignment.MIDDLE_RIGHT); calendarComponent = new CalendarDisplay(); mainContent.addComponent(calendarComponent); mainContent.setExpandRatio(calendarComponent, 1); mainContent.setComponentAlignment(calendarComponent, Alignment.MIDDLE_CENTER); HorizontalLayout spacing = new HorizontalLayout(); spacing.setHeight("30px"); mainContent.addComponent(spacing); HorizontalLayout noteInfoLayout = new HorizontalLayout(); noteInfoLayout.setSpacing(true); HorizontalLayout noteWapper = new HorizontalLayout(); noteWapper.setHeight("30px"); Label noteLbl = new Label("Note:"); noteWapper.addComponent(noteLbl); noteWapper.setComponentAlignment(noteLbl, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(noteWapper); HorizontalLayout completeWapper = new HorizontalLayout(); completeWapper.setWidth("100px"); completeWapper.setHeight("30px"); completeWapper.addStyleName("eventLblcompleted"); Label completeLabel = new Label("Completed"); completeWapper.addComponent(completeLabel); completeWapper.setComponentAlignment(completeLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(completeWapper); HorizontalLayout overdueWapper = new HorizontalLayout(); overdueWapper.setWidth("100px"); overdueWapper.setHeight("30px"); overdueWapper.addStyleName("eventLbloverdue"); Label overdueLabel = new Label("Overdue"); overdueWapper.addComponent(overdueLabel); overdueWapper.setComponentAlignment(overdueLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(overdueWapper); HorizontalLayout futureWapper = new HorizontalLayout(); futureWapper.setWidth("100px"); futureWapper.setHeight("30px"); futureWapper.addStyleName("eventLblfuture"); Label futureLabel = new Label("Future"); futureWapper.addComponent(futureLabel); futureWapper.setComponentAlignment(futureLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(futureWapper); mainContent.addComponent(noteInfoLayout); mainContent.setComponentAlignment(noteInfoLayout, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityRelatedItemListComp.java
License:Open Source License
private void initUI() { if (allowCreateNew) { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true);/* w w w. j ava 2s .c om*/ final Button newTaskBtn = new Button("New Task", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem("task"); } }); newTaskBtn.setIcon(FontAwesome.PLUS); newTaskBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); newTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK); buttonLayout.addComponent(newTaskBtn); final Button newCallBtn = new Button("New Call", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem("call"); } }); newCallBtn.setIcon(FontAwesome.PLUS); newCallBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); newCallBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonLayout.addComponent(newCallBtn); final Button newMeetingBtn = new Button("New Meeting", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem("call"); } }); newMeetingBtn.setIcon(FontAwesome.PLUS); newMeetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); newMeetingBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonLayout.addComponent(newMeetingBtn); this.addComponent(buttonLayout); this.addStyleName("activity-realated-content"); } tableItem = new ActivityTableDisplay(Arrays.asList( new TableViewField(ActivityI18nEnum.FORM_SUBJECT, "subject", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(ActivityI18nEnum.FORM_STATUS, "status", UIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(TaskI18nEnum.FORM_START_DATE, "startDate", UIConstants.TABLE_DATE_TIME_WIDTH), new TableViewField(TaskI18nEnum.TABLE_END_DATE_HEADER, "endDate", UIConstants.TABLE_DATE_TIME_WIDTH))); tableItem.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleActivity simpleEvent = (SimpleActivity) event.getData(); if (CrmTypeConstants.TASK.equals(simpleEvent.getEventType())) { EventBusFactory.getInstance().post(new ActivityEvent.TaskRead(this, simpleEvent.getId())); } else if (CrmTypeConstants.MEETING.equals(simpleEvent.getEventType())) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingRead(this, simpleEvent.getId())); } else if (CrmTypeConstants.CALL.equals(simpleEvent.getEventType())) { EventBusFactory.getInstance().post(new ActivityEvent.CallRead(this, simpleEvent.getId())); } } }); this.addComponent(tableItem); }
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 w w w . j a 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.campaign.CampaignListNoItemView.java
License:Open Source License
public CampaignListNoItemView() { VerticalLayout layout = new VerticalLayout(); layout.addStyleName("case-noitem"); layout.setWidth("800px"); layout.setSpacing(true);//w w w.j a va 2 s . c o m 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); }
From source file:com.esofthead.mycollab.module.crm.view.campaign.CampaignSelectionField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Button browseBtn = new Button(null, FontAwesome.ELLIPSIS_H); browseBtn.addStyleName(UIConstants.THEME_GRAY_LINK); browseBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); browseBtn.addClickListener(new Button.ClickListener() { @Override// w ww. jav a 2 s.c o m public void buttonClick(Button.ClickEvent clickEvent) { CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(CampaignSelectionField.this); UI.getCurrent().addWindow(campaignWindow); campaignWindow.show(); } }); Button clearBtn = new Button(null, FontAwesome.TRASH_O); clearBtn.addStyleName(UIConstants.THEME_GRAY_LINK); clearBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); clearBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { campaignName.setValue(""); internalValue = null; } }); layout.with(campaignName, browseBtn, clearBtn).expand(campaignName); return layout; }
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);// www . ja v a 2s .co m 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);/*from w w w . ja v a2s . com*/ 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.CrmToolbar.java
License:Open Source License
public void gotoItem(final String crmItem) { for (final Iterator<com.vaadin.ui.Component> it = this.iterator(); it.hasNext();) { final Button btn = (Button) it.next(); if (crmItem.equals(btn.getCaption())) { btn.addStyleName("isSelected"); } else {/* w w w . java 2 s . c o m*/ btn.removeStyleName("isSelected"); } } }
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 ww w . j a v a2s . 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); }