List of usage examples for com.vaadin.ui TextField TextField
public TextField()
TextField
with no caption. From source file:com.dungnv.streetfood.view.SlideShowView.java
private void init() { header = new VerticalLayout(); header.addStyleName("viewheader"); header.setSpacing(true);//from w w w . j av a2 s . c o m header.setId("hehehe"); titleLabel = new Label(BundleUtils.getLanguage("menu.RESTAURANT")); titleLabel.setId(TITLE_ID); titleLabel.setWidth("100%"); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); header.addComponent(titleLabel); btnAdd = new Button(); btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml()); btnAdd.setCaptionAsHtml(true); btnAdd.addStyleName("float-button"); // add.addStyleName(ValoTheme.BUTTON_BORDERLESS); // add.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // add.addStyleName(ValoTheme.BUTTON_LARGE); header.addComponent(btnAdd); HorizontalLayout item = new HorizontalLayout(); // item.setSpacing(true); item.setWidth("100%"); header.addComponent(item); txtSearch = new TextField(); txtSearch.setImmediate(true); txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT); txtSearch.setIcon(FontAwesome.SEARCH); txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.slideShow.name.input")); txtSearch.setWidth("100%"); item.addComponent(txtSearch); item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT); lbAdvanced = new Button(); lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced")); lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK); lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE); item.addComponent(lbAdvanced); item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT); uiSearchPaged = new CommonSearchPagedUI(1) { @Override public void cbChanged() { this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(false); } } }); this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { onSearch(true); } } }); } }; header.addComponent(uiSearchPaged); searchLayout = new VerticalLayout(); // searchLayout.setSpacing(true); searchLayout.setSizeFull(); header.addComponent(searchLayout); searchDetail = new SlideShowSearchDetail(this); }
From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if ("type".equals(propertyId)) { AccountTypeComboBox accountTypeBox = new AccountTypeComboBox(); return accountTypeBox; } else if ("industry".equals(propertyId)) { IndustryComboBox accountIndustryBox = new IndustryComboBox(); return accountIndustryBox; } else if ("assignuser".equals(propertyId)) { ActiveUserComboBox userBox = new ActiveUserComboBox(); userBox.select(attachForm.getBean().getAssignuser()); return userBox; } else if ("description".equals(propertyId)) { TextArea textArea = new TextArea("", ""); textArea.setNullRepresentation(""); return textArea; } else if ("billingcountry".equals(propertyId) || "shippingcountry".equals(propertyId)) { CountryComboBox billingCountryComboBox = new CountryComboBox(); return billingCountryComboBox; } else if (propertyId.equals("accountname")) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true);/* w w w . j a va 2 s. co m*/ tf.setRequiredError(AppContext.getMessage(AccountI18nEnum.ERROR_ACCOUNT_NAME_IS_NULL)); } return tf; } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.AssignmentEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("startdate")) { return new DatePicker(); } else if (propertyId.equals("duedate")) { return new DatePicker(); } else if (propertyId.equals("status")) { return new TaskStatusComboBox(); } else if (propertyId.equals("priority")) { return new TaskPriorityComboBox(); } else if (propertyId.equals("description")) { TextArea descArea = new TextArea(); descArea.setNullRepresentation(""); return descArea; } else if (propertyId.equals("contactid")) { ContactSelectionField field = new ContactSelectionField(); return field; } else if (propertyId.equals("subject")) { TextField tf = new TextField(); if (isValidateForm) { tf.setRequired(true);/*from ww w . ja va 2 s .co m*/ tf.setRequiredError("Subject must not be null"); tf.setNullRepresentation(""); } return tf; } else if (propertyId.equals("typeid")) { return new RelatedItemSelectionField(attachForm.getBean()); } else if (propertyId.equals("type")) { return new DummyCustomField<String>(); } else if (propertyId.equals("assignuser")) { ActiveUserComboBox userBox = new ActiveUserComboBox(); userBox.select(attachForm.getBean().getAssignuser()); return userBox; } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.MeetingEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("subject")) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true);//ww w.j ava 2 s .c om tf.setRequiredError("Subject must not be null"); } return tf; } else if (propertyId.equals("status")) { return new MeetingStatusComboBox(); } else if (propertyId.equals("startdate")) { return new DatePicker(); } else if (propertyId.equals("enddate")) { return new DatePicker(); } else if (propertyId.equals("description")) { TextArea descArea = new TextArea(); descArea.setNullRepresentation(""); return descArea; } else if (propertyId.equals("typeid")) { return new RelatedItemSelectionField(attachForm.getBean()); } else if (propertyId.equals("type")) { return new DummyCustomField<String>(); } else if (propertyId.equals("isrecurrence")) { return null; } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if ("type".equals(propertyId)) { CampaignTypeComboBox typeCombo = new CampaignTypeComboBox(); typeCombo.setWidth("100%"); return typeCombo; } else if ("status".equals(propertyId)) { CampaignStatusComboBox statusCombo = new CampaignStatusComboBox(); statusCombo.setWidth("100%"); return statusCombo; } else if ("campaignname".equals(propertyId)) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true);/*from ww w .j ava 2 s . c om*/ tf.setRequiredError("Name must not be null"); } return tf; } else if ("description".equals(propertyId)) { TextArea descArea = new TextArea(); descArea.setNullRepresentation(""); return descArea; } else if ("assignuser".equals(propertyId)) { ActiveUserComboBox userBox = new ActiveUserComboBox(); userBox.select(attachForm.getBean().getAssignuser()); return userBox; } else if (propertyId.equals("currencyid")) { return new CurrencyComboBoxField(); } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.cases.CaseEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("priority")) { return new CasePriorityComboBox(); } else if (propertyId.equals("status")) { return new CaseStatusComboBox(); } else if (propertyId.equals("reason")) { return new CaseReasonComboBox(); } else if (propertyId.equals("origin")) { return new CasesOriginComboBox(); } else if (propertyId.equals("type")) { return new CaseTypeComboBox(); } else if (propertyId.equals("description")) { TextArea descArea = new TextArea("", ""); descArea.setNullRepresentation(""); return descArea; } else if (propertyId.equals("resolution")) { TextArea reArea = new TextArea("", ""); reArea.setNullRepresentation(""); return reArea; } else if (propertyId.equals("accountid")) { AccountSelectionField accountField = new AccountSelectionField(); accountField.setRequired(true);/*from w ww . j a v a 2 s . c o m*/ return accountField; } else if (propertyId.equals("subject")) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true); tf.setRequiredError("Subject must not be null"); } return tf; } else if (propertyId.equals("assignuser")) { ActiveUserComboBox userBox = new ActiveUserComboBox(); userBox.select(attachForm.getBean().getAssignuser()); return userBox; } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.contact.ContactEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("firstname") || propertyId.equals("prefix")) { return firstNamePrefixField; } else if (propertyId.equals("leadsource")) { LeadSourceComboBox leadSource = new LeadSourceComboBox(); return leadSource; } else if (propertyId.equals("accountid")) { AccountSelectionField accountField = new AccountSelectionField(); return accountField; } else if (propertyId.equals("lastname")) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true);/* ww w.ja va 2 s . c o m*/ tf.setRequiredError("Last name must not be null"); } return tf; } else if (propertyId.equals("description")) { TextArea descArea = new TextArea(); descArea.setNullRepresentation(""); return descArea; } else if (propertyId.equals("assignuser")) { ActiveUserComboBox userBox = new ActiveUserComboBox(); userBox.select(attachForm.getBean().getAssignuser()); return userBox; } else if (propertyId.equals("primcountry") || propertyId.equals("othercountry")) { CountryComboBox otherCountryComboBox = new CountryComboBox(); return otherCountryComboBox; } else if (propertyId.equals("birthday")) { return new BirthdayPickerField(); } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.lead.LeadEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("firstname") || propertyId.equals("prefixname")) { return firstNamePrefixField; } else if (propertyId.equals("primcountry") || propertyId.equals("othercountry")) { CountryComboBox otherCountryComboBox = new CountryComboBox(); return otherCountryComboBox; } else if (propertyId.equals("status")) { LeadStatusComboBox statusComboBox = new LeadStatusComboBox(); return statusComboBox; } else if (propertyId.equals("industry")) { IndustryComboBox industryComboBox = new IndustryComboBox(); return industryComboBox; } else if (propertyId.equals("assignuser")) { ActiveUserComboBox userComboBox = new ActiveUserComboBox(); return userComboBox; } else if (propertyId.equals("source")) { LeadSourceComboBox statusComboBox = new LeadSourceComboBox(); return statusComboBox; } else if (propertyId.equals("lastname")) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true);//from ww w . j a va 2s . co m tf.setRequiredError("Last name must not be null"); } return tf; } else if (propertyId.equals("description")) { TextArea descArea = new TextArea(); descArea.setNullRepresentation(""); return descArea; } else if (propertyId.equals("accountname")) { TextField txtField = new TextField(); if (isValidateForm) { txtField.setRequired(true); txtField.setRequiredError("Account name must be not null"); } return txtField; } return null; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityEditFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { if (propertyId.equals("campaignid")) { return new CampaignSelectionField(); } else if (propertyId.equals("accountid")) { AccountSelectionField accountField = new AccountSelectionField(); accountField.setRequired(true);//ww w . j a va2 s . c o m return accountField; } else if (propertyId.equals("opportunityname")) { TextField tf = new TextField(); if (isValidateForm) { tf.setNullRepresentation(""); tf.setRequired(true); tf.setRequiredError("Name must not be null"); } return tf; } else if (propertyId.equals("currencyid")) { CurrencyComboBoxField currencyBox = new CurrencyComboBoxField(); return currencyBox; } else if (propertyId.equals("salesstage")) { return new OpportunitySalesStageComboBox(); } else if (propertyId.equals("opportunitytype")) { return new OpportunityTypeComboBox(); } else if (propertyId.equals("source")) { return new LeadSourceComboBox(); } else if (propertyId.equals("description")) { TextArea descArea = new TextArea(); descArea.setNullRepresentation(""); return descArea; } else if (propertyId.equals("assignuser")) { ActiveUserComboBox userBox = new ActiveUserComboBox(); return userBox; } return null; }
From source file:com.esofthead.mycollab.mobile.module.project.view.message.MessageAddViewImpl.java
License:Open Source License
public MessageAddViewImpl() { this.addStyleName("message-add-view"); this.setCaption(AppContext.getMessage(MessageI18nEnum.M_VIEW_ADD_TITLE)); this.content = new CssLayout(); this.content.setStyleName("content-layout"); this.content.setSizeFull(); this.setContent(this.content); VerticalLayout addFormLayout = new VerticalLayout(); addFormLayout.setStyleName("addform-layout"); addFormLayout.setWidth("100%"); subjectField = new TextField(); subjectField.setStyleName("title-field"); subjectField.setWidth("100%"); subjectField.setInputPrompt(AppContext.getMessage(MessageI18nEnum.FORM_TITLE)); addFormLayout.addComponent(subjectField); contentField = new TextArea(); contentField.setStyleName("content-field"); contentField.setWidth("100%"); contentField.setInputPrompt(AppContext.getMessage(MessageI18nEnum.M_FORM_CONTENT_FIELD_PROMPT)); addFormLayout.addComponent(contentField); VerticalComponentGroup bottomRow = new VerticalComponentGroup(); bottomRow.setStyleName("bottom-row"); bottomRow.setWidth("100%"); isStickField = new Switch(AppContext.getMessage(MessageI18nEnum.FORM_IS_STICK), false); bottomRow.addComponent(isStickField); attachment = new MessageAttachmentField(); attachment.setCaption(null);//from w ww . j a v a2 s . com bottomRow.addComponent(attachment); this.content.addComponent(addFormLayout); this.content.addComponent(bottomRow); this.saveBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_DONE)); this.saveBtn.addStyleName("save-btn"); this.saveBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -2038682412445718948L; @Override public void buttonClick(Button.ClickEvent event) { final SimpleMessage message = new SimpleMessage(); message.setProjectid(CurrentProjectVariables.getProjectId()); message.setPosteddate(new GregorianCalendar().getTime()); if (!subjectField.getValue().toString().trim().equals("")) { message.setTitle(subjectField.getValue()); message.setMessage(contentField.getValue()); message.setPosteduser(AppContext.getUsername()); message.setSaccountid(AppContext.getAccountId()); message.setIsstick(isStickField.getValue()); MessageAddViewImpl.this.fireSaveItem(message); } else { subjectField.addStyleName("errorField"); NotificationUtil.showErrorNotification( AppContext.getMessage(MessageI18nEnum.FORM_TITLE_REQUIRED_ERROR)); } } }); this.setRightComponent(saveBtn); }