List of usage examples for com.vaadin.ui Button addClickListener
public Registration addClickListener(ClickListener listener)
From source file:com.esofthead.mycollab.mobile.module.crm.view.CrmLoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);/*from w ww .ja va 2 s .c om*/ contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); Label welcomeText = new Label("Login to CRM"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] { emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) })); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.module.crm.view.lead.LeadListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { Button addLead = new Button(); addLead.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -6024437571619598638L; @Override/*from ww w.jav a 2 s . c o m*/ public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null)); } }); addLead.setStyleName("add-btn"); return addLead; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);//from ww w . jav a2 s .c om Button relatedCampaigns = new Button(); relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_CAMPAIGN) + "</div>"); relatedCampaigns.setHtmlContentAllowed(true); relatedCampaigns.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7027681785871215444L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems(LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns))); } }); toolbarLayout.addComponent(relatedCampaigns); Button relatedNotes = new Button(); relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE) + "</div>"); relatedNotes.setHtmlContentAllowed(true); relatedNotes.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance() .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes))); } }); toolbarLayout.addComponent(relatedNotes); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post( new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))); } }); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.lead.LeadRelatedCampaignView.java
License:Open Source License
@Override protected Component createRightComponent() { NavigationBarQuickMenu addCampaign = new NavigationBarQuickMenu(); addCampaign.setStyleName("add-btn"); VerticalLayout addBtns = new VerticalLayout(); addBtns.setStyleName("edit-btn-layout"); addBtns.setSpacing(true);//w w w .j a v a 2 s. c o m addBtns.setMargin(true); addBtns.setWidth("100%"); Button newCampaign = new Button(AppContext.getMessage(CampaignI18nEnum.VIEW_NEW_TITLE)); newCampaign.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addBtns.addComponent(newCampaign); Button selectCampaign = new Button(AppContext.getMessage(CampaignI18nEnum.M_TITLE_SELECT_CAMPAIGNS)); selectCampaign.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 6803421194441320713L; @Override public void buttonClick(Button.ClickEvent event) { final LeadCampaignSelectionView campaignSelectionView = new LeadCampaignSelectionView( LeadRelatedCampaignView.this); CampaignSearchCriteria criteria = new CampaignSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); campaignSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(LeadRelatedCampaignView.this, campaignSelectionView)); } }); addBtns.addComponent(selectCampaign); addCampaign.setContent(addBtns); return addCampaign; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { Button addOpportunity = new Button(); addOpportunity.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7172838996944732255L; @Override//from ww w . ja va 2 s. c o m public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new OpportunityEvent.GotoAdd(this, null)); } }); addOpportunity.setStyleName("add-btn"); return addOpportunity; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);// www.j av a2s . c o m Button relatedContacts = new Button(); relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>"); relatedContacts.setHtmlContentAllowed(true); relatedContacts.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))); } }); toolbarLayout.addComponent(relatedContacts); Button relatedLeads = new Button(); relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_LEAD) + "</div>"); relatedLeads.setHtmlContentAllowed(true); relatedLeads.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post( new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))); } }); toolbarLayout.addComponent(relatedLeads); Button relatedNotes = new Button(); relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE) + "</div>"); relatedNotes.setHtmlContentAllowed(true); relatedNotes.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post( new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes))); } }); toolbarLayout.addComponent(relatedNotes); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))); } }); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityRelatedContactView.java
License:Open Source License
@Override protected Component createRightComponent() { NavigationBarQuickMenu addContact = new NavigationBarQuickMenu(); addContact.setStyleName("add-btn"); VerticalLayout addBtns = new VerticalLayout(); addBtns.setStyleName("edit-btn-layout"); addBtns.setSpacing(true);//w w w .j a v a2 s. c om addBtns.setMargin(true); addBtns.setWidth("100%"); 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(""); } }); addBtns.addComponent(newContact); Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS)); selectContact.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 200350509131199170L; @Override public void buttonClick(Button.ClickEvent event) { final OpportunityContactSelectionView contactSelectionView = new OpportunityContactSelectionView( OpportunityRelatedContactView.this); ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); contactSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(OpportunityRelatedContactView.this, contactSelectionView)); } }); addBtns.addComponent(selectContact); addContact.setContent(addBtns); return addContact; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityRelatedLeadView.java
License:Open Source License
@Override protected Component createRightComponent() { NavigationBarQuickMenu addLead = new NavigationBarQuickMenu(); addLead.setStyleName("add-btn"); VerticalLayout addBtns = new VerticalLayout(); addBtns.setStyleName("edit-btn-layout"); addBtns.setSpacing(true);/*from w w w.ja v a2 s . c om*/ addBtns.setMargin(true); addBtns.setWidth("100%"); 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 = -1004824769733665112L; @Override public void buttonClick(Button.ClickEvent event) { final OpportunityLeadSelectionView leadSelectionView = new OpportunityLeadSelectionView( OpportunityRelatedLeadView.this); LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); leadSelectionView.setSearchCriteria(criteria); EventBusFactory.getInstance() .post(new ShellEvent.PushView(OpportunityRelatedLeadView.this, leadSelectionView)); } }); addBtns.addComponent(selectLead); addLead.setContent(addBtns); return addLead; }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java
License:Open Source License
private void constructUI() { this.setWidth("100%"); statusWrapper = new CssLayout(); statusWrapper.setWidth("100%"); statusWrapper.setStyleName("upload-status-wrap"); this.addComponent(statusWrapper); inputWrapper = new HorizontalLayout(); inputWrapper.setWidth("100%"); inputWrapper.setStyleName("comment-box"); inputWrapper.setSpacing(true);//from w w w. j a v a 2 s . c o m inputWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.prepareUploadField(); inputWrapper.addComponent(uploadField); commentInput = new TextArea(); commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); commentInput.setSizeFull(); inputWrapper.addComponent(commentInput); inputWrapper.setExpandRatio(commentInput, 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 = 6687918902751556313L; @Override public void buttonClick(Button.ClickEvent arg0) { final Comment comment = new Comment(); comment.setComment(commentInput.getValue()); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type.toString()); comment.setTypeid("" + typeid); comment.setExtratypeid(extraTypeId); final CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class); int commentId = commentService.saveWithSession(comment, AppContext.getUsername(), isSendingEmailRelay, emailHandlerClass); String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(type, AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeid, commentId); if (!"".equals(attachmentPath)) { saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentInput.setValue(""); statusWrapper.removeAllComponents(); component.reload(); } }); inputWrapper.addComponent(postBtn); this.addComponent(inputWrapper); }
From source file:com.esofthead.mycollab.mobile.module.project.view.bug.BugListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { Button addBug = new Button(); addBug.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 8204610801164300917L; @Override//w w w . j a v a2 s. c o m public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null)); } }); addBug.setStyleName("add-btn"); return addBug; }