List of usage examples for com.vaadin.ui Button Button
public Button(Resource icon)
From source file:com.esofthead.mycollab.mobile.module.crm.ui.CrmPreviewFormControlsGenerator.java
License:Open Source License
public VerticalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) { boolean canRead = true; boolean canWrite = true; boolean canAccess = true; if (permissionItem != null) { canRead = AppContext.canRead(permissionItem); canWrite = AppContext.canWrite(permissionItem); canAccess = AppContext.canAccess(permissionItem); }/*w ww . j a v a2 s . com*/ if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT)); editBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireEditForm(item); } }); editBtn.setWidth("100%"); editButtons.addComponent(editBtn); editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER); editBtn.setEnabled(canWrite); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireDeleteForm(item); } }); deleteBtn.setWidth("100%"); editButtons.addComponent(deleteBtn); editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER); deleteBtn.setEnabled(canAccess); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE)); cloneBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireCloneForm(item); } }); cloneBtn.setWidth("100%"); editButtons.addComponent(cloneBtn); editButtons.setComponentAlignment(cloneBtn, Alignment.MIDDLE_CENTER); cloneBtn.setEnabled(canWrite); } return editButtons; }
From source file:com.esofthead.mycollab.mobile.module.crm.ui.NotesList.java
License:Open Source License
private void initUI() { noteList = new BeanList<NoteService, NoteSearchCriteria, SimpleNote>(noteService, NoteRowDisplayHandler.class); noteList.setDisplayEmptyListText(false); noteList.setStyleName("noteList"); noteListContainer = new VerticalLayout(); this.setContent(noteListContainer); displayNotes();// w w w .j a v a2s . c o m HorizontalLayout commentBox = new HorizontalLayout(); commentBox.setSizeFull(); commentBox.setStyleName("comment-box"); commentBox.setSpacing(true); commentBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); final TextArea noteInput = new TextArea(); noteInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); noteInput.setSizeFull(); commentBox.addComponent(noteInput); commentBox.setExpandRatio(noteInput, 1.0f); Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND)); postBtn.setStyleName("submit-btn"); postBtn.setWidthUndefined(); postBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -5095455325725786794L; @Override public void buttonClick(Button.ClickEvent event) { final Note note = new Note(); note.setCreateduser(AppContext.getUsername()); note.setNote(noteInput.getValue()); note.setSaccountid(AppContext.getAccountId()); note.setSubject(""); note.setType(type); note.setTypeid(typeid); note.setCreatedtime(new GregorianCalendar().getTime()); note.setLastupdatedtime(new GregorianCalendar().getTime()); noteService.saveWithSession(note, AppContext.getUsername()); // Save Relay Email -- having time must refact to // Aop // ------------------------------------------------------ RelayEmailNotification relayNotification = new RelayEmailNotification(); relayNotification.setChangeby(AppContext.getUsername()); relayNotification.setChangecomment(noteInput.getValue()); relayNotification.setSaccountid(AppContext.getAccountId()); relayNotification.setType(type); relayNotification.setAction(MonitorTypeConstants.ADD_COMMENT_ACTION); relayNotification.setTypeid("" + typeid); if (type.equals(CrmTypeConstants.ACCOUNT)) { relayNotification.setEmailhandlerbean(AccountRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CONTACT)) { relayNotification.setEmailhandlerbean(ContactRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CAMPAIGN)) { relayNotification.setEmailhandlerbean(CampaignRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.LEAD)) { relayNotification.setEmailhandlerbean(LeadRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.OPPORTUNITY)) { relayNotification.setEmailhandlerbean(OpportunityRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CASE)) { relayNotification.setEmailhandlerbean(CaseRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.TASK)) { relayNotification.setEmailhandlerbean(TaskRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.MEETING)) { relayNotification.setEmailhandlerbean(MeetingRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CALL)) { relayNotification.setEmailhandlerbean(CallRelayEmailNotificationAction.class.getName()); } RelayEmailNotificationService relayEmailNotificationService = ApplicationContextUtil .getSpringBean(RelayEmailNotificationService.class); relayEmailNotificationService.saveWithSession(relayNotification, AppContext.getUsername()); noteInput.setValue(""); displayNotes(); } }); commentBox.addComponent(postBtn); this.setToolbar(commentBox); }
From source file:com.esofthead.mycollab.mobile.module.crm.ui.RelatedReadItemField.java
License:Open Source License
@Override protected Component initContent() { try {//from w w w . j a v a 2 s . c o m final String type = (String) PropertyUtils.getProperty(RelatedReadItemField.this.bean, "type"); if (type == null || type.equals("")) { return new Label(""); } final Integer typeid = (Integer) PropertyUtils.getProperty(bean, "typeid"); if (typeid == null) { return new Label(""); } Resource 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 = MyCollabResource.newResource("icons/16/crm/account.png"); } } 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 = MyCollabResource.newResource("icons/16/crm/campaign.png"); } } 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 = MyCollabResource.newResource("icons/16/crm/contact.png"); } } 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 = MyCollabResource.newResource("icons/16/crm/lead.png"); } } 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 = MyCollabResource.newResource("icons/16/crm/opportunity.png"); } } 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 = MyCollabResource.newResource("icons/16/crm/case.png"); } } Button related = new Button(relateItemName); if (relatedLink != null) related.setIcon(relatedLink); if (relatedLink != null) { return related; } else { return new Label(""); } } catch (Exception e) { return new Label(""); } }
From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedContactView.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu(); addContact.setStyleName("add-btn"); VerticalLayout addButtons = new VerticalLayout(); addButtons.setSpacing(true);//w w w .java2 s. c o m addButtons.setWidth("100%"); addButtons.setMargin(true); addButtons.addStyleName("edit-btn-layout"); Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE)); newContact.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addButtons.addComponent(newContact); Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS)); selectContact.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 243969948418203441L; @Override public void buttonClick(Button.ClickEvent event) { AccountContactSelectionView contactSelectionView = new AccountContactSelectionView( AccountRelatedContactView.this); final ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); contactSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(AccountRelatedContactView.this, contactSelectionView)); } }); addButtons.addComponent(selectContact); addContact.setContent(addButtons); return addContact; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedLeadView.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addLead = new NavigationBarQuickMenu(); addLead.setStyleName("add-btn"); VerticalLayout addButtons = new VerticalLayout(); addButtons.setSpacing(true);//from w w w. ja v a 2 s . co m addButtons.setWidth("100%"); addButtons.setMargin(true); addButtons.addStyleName("edit-btn-layout"); Button newLead = new Button(AppContext.getMessage(LeadI18nEnum.VIEW_NEW_TITLE)); newLead.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 8228954365650824438L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addButtons.addComponent(newLead); Button selectLead = new Button(AppContext.getMessage(LeadI18nEnum.M_TITLE_SELECT_LEADS)); selectLead.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 9076596614526838523L; @Override public void buttonClick(Button.ClickEvent event) { AccountLeadSelectionView leadSelectionView = new AccountLeadSelectionView( AccountRelatedLeadView.this); final LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); leadSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(AccountRelatedLeadView.this, leadSelectionView)); } }); addButtons.addComponent(selectLead); addLead.setContent(addButtons); return addLead; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.ActivityListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addActivity = new NavigationBarQuickMenu(); addActivity.setStyleName("add-btn"); addButtons = new VerticalLayout(); addButtons.setSpacing(true);/*from ww w . j av a2s. co m*/ addButtons.setWidth("100%"); addButtons.setMargin(true); addButtons.addStyleName("edit-btn-layout"); Button addTask = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK)); addTask.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1920289198458066344L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null)); } }); addButtons.addComponent(addTask); Button addCall = new Button(AppContext.getMessage(CallI18nEnum.BUTTON_NEW_CALL)); addCall.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -279151189261011902L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null)); } }); addButtons.addComponent(addCall); Button addMeeting = new Button(AppContext.getMessage(MeetingI18nEnum.BUTTON_NEW_MEETING)); addMeeting.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 4770664404728700960L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null)); } }); addButtons.addComponent(addMeeting); addActivity.setContent(addButtons); return addActivity; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.ActivityRelatedItemView.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addActivity = new NavigationBarQuickMenu(); addActivity.setStyleName("add-btn"); addButtons = new VerticalLayout(); addButtons.setSpacing(true);//w ww .j av a 2 s . co m addButtons.setWidth("100%"); addButtons.setMargin(true); addButtons.addStyleName("edit-btn-layout"); Button addTask = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK)); addTask.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1920289198458066344L; @Override public void buttonClick(Button.ClickEvent event) { fireNewRelatedItem(CrmTypeConstants.TASK); } }); addButtons.addComponent(addTask); Button addCall = new Button(AppContext.getMessage(CallI18nEnum.BUTTON_NEW_CALL)); addCall.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -279151189261011902L; @Override public void buttonClick(Button.ClickEvent event) { fireNewRelatedItem(CrmTypeConstants.CALL); } }); addButtons.addComponent(addCall); Button addMeeting = new Button(AppContext.getMessage(MeetingI18nEnum.BUTTON_NEW_MEETING)); addMeeting.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 4770664404728700960L; @Override public void buttonClick(Button.ClickEvent event) { fireNewRelatedItem(CrmTypeConstants.MEETING); } }); addButtons.addComponent(addMeeting); addActivity.setContent(addButtons); return addActivity; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignRelatedAccountView.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addAccount = new NavigationBarQuickMenu(); addAccount.setStyleName("add-btn"); VerticalLayout addButtons = new VerticalLayout(); addButtons.setSpacing(true);/*from w w w. j a v a 2 s . c o m*/ addButtons.setWidth("100%"); addButtons.setMargin(true); addButtons.addStyleName("edit-btn-layout"); Button newAccount = new Button(AppContext.getMessage(AccountI18nEnum.VIEW_NEW_TITLE)); newAccount.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addButtons.addComponent(newAccount); Button selectAccount = new Button(AppContext.getMessage(AccountI18nEnum.M_TITLE_SELECT_ACCOUNTS)); selectAccount.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 270503987054356318L; @Override public void buttonClick(Button.ClickEvent event) { CampaignAccountSelectionView accountSelectionView = new CampaignAccountSelectionView( CampaignRelatedAccountView.this); AccountSearchCriteria criteria = new AccountSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); accountSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(CampaignRelatedAccountView.this, accountSelectionView)); } }); addButtons.addComponent(selectAccount); addAccount.setContent(addButtons); return addAccount; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignRelatedContactView.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu(); addContact.setStyleName("add-btn"); VerticalLayout addButtons = new VerticalLayout(); addButtons.setWidth("100%"); addButtons.setSpacing(true);/* w ww . j a va 2 s . co m*/ addButtons.setMargin(true); addButtons.setStyleName("edit-btn-layout"); Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE)); newContact.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addButtons.addComponent(newContact); Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS)); selectContact.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -429296782998301810L; @Override public void buttonClick(Button.ClickEvent event) { CampaignContactSelectionView contactSelectionView = new CampaignContactSelectionView( CampaignRelatedContactView.this); ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); contactSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(CampaignRelatedContactView.this, contactSelectionView)); } }); addButtons.addComponent(selectContact); addContact.setContent(addButtons); return addContact; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignRelatedLeadView.java
License:Open Source License
@Override protected Component createRightComponent() { final NavigationBarQuickMenu addLead = new NavigationBarQuickMenu(); addLead.setStyleName("add-btn"); VerticalLayout addBtns = new VerticalLayout(); addBtns.setWidth("100%"); addBtns.setSpacing(true);//from ww w.j a va 2 s . co m addBtns.setMargin(true); addBtns.setStyleName("edit-btn-layout"); Button newLead = new Button(AppContext.getMessage(LeadI18nEnum.VIEW_NEW_TITLE)); newLead.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addBtns.addComponent(newLead); Button selectLead = new Button(AppContext.getMessage(LeadI18nEnum.M_TITLE_SELECT_LEADS)); selectLead.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8749458276290086097L; @Override public void buttonClick(Button.ClickEvent event) { CampaignLeadSelectionView leadSelectionView = new CampaignLeadSelectionView( CampaignRelatedLeadView.this); LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); leadSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(CampaignRelatedLeadView.this, leadSelectionView)); } }); addBtns.addComponent(selectLead); addLead.setContent(addBtns); return addLead; }