Example usage for com.vaadin.ui TextField TextField

List of usage examples for com.vaadin.ui TextField TextField

Introduction

In this page you can find the example usage for com.vaadin.ui TextField TextField.

Prototype

public TextField() 

Source Link

Document

Constructs an empty TextField with no caption.

Usage

From source file:com.esofthead.mycollab.mobile.module.project.view.milestone.MilestoneEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("owner")) {
        final ProjectMemberSelectionField userbox = new ProjectMemberSelectionField();
        userbox.setRequired(true);/*from  w  w  w.j  a va2s  . c o m*/
        userbox.setRequiredError("Please select an assignee");
        return userbox;
    } else if (propertyId.equals("status")) {
        if (attachForm.getBean().getStatus() == null) {
            attachForm.getBean().setStatus(MilestoneStatus.InProgress.toString());
        }
        return new ProgressStatusComboBox();
    } else if (propertyId.equals("name")) {
        final TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);
            tf.setRequiredError("Please enter name");
        }
        return tf;
    } else if (propertyId.equals("startdate") || propertyId.equals("enddate")) {
        return new DatePicker();
    } else if (propertyId.equals("description")) {
        final TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    }

    return null;
}

From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("assignuser")) {
        return new ProjectMemberSelectionField();
    } else if (propertyId.equals("tasklistid")) {
        return new TaskListSelectionField();
    } else if (propertyId.equals("notes")) {
        final TextArea textArea = new TextArea();
        textArea.setNullRepresentation("");
        return textArea;
    } else if ("name".equals(propertyId)) {
        final TextField tf = new TextField();
        tf.setNullRepresentation("");
        tf.setRequired(true);// ww w .j av  a2  s.  c  om
        tf.setRequiredError("Please enter a Name");
        return tf;
    } else if ("percentagecomplete".equals(propertyId)) {
        return new TaskPercentageCompleteComboBox();
    } else if ("priority".equals(propertyId)) {
        return new TaskPriorityComboBox();
    }
    return null;
}

From source file:com.esofthead.mycollab.module.crm.ui.components.RelatedEditItemField.java

License:Open Source License

public RelatedEditItemField(String[] types, Object bean) {
    this.bean = bean;

    relatedItemComboBox = new RelatedItemComboBox(types);
    itemField = new TextField();
    itemField.setEnabled(true);//from   w  w  w  . j  ava 2s.  c  o  m

    browseBtn = new Button(null, FontAwesome.ELLIPSIS_H);
    browseBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    browseBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            String type = (String) relatedItemComboBox.getValue();
            if ("Account".equals(type)) {
                AccountSelectionWindow accountWindow = new AccountSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(accountWindow);
                accountWindow.show();
            } else if ("Campaign".equals(type)) {
                CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(campaignWindow);
                campaignWindow.show();
            } else if ("Contact".equals(type)) {
                ContactSelectionWindow contactWindow = new ContactSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(contactWindow);
                contactWindow.show();
            } else if ("Lead".equals(type)) {
                LeadSelectionWindow leadWindow = new LeadSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(leadWindow);
                leadWindow.show();
            } else if ("Opportunity".equals(type)) {
                OpportunitySelectionWindow opportunityWindow = new OpportunitySelectionWindow(
                        RelatedEditItemField.this);
                UI.getCurrent().addWindow(opportunityWindow);
                opportunityWindow.show();
            } else if ("Case".equals(type)) {
                CaseSelectionWindow caseWindow = new CaseSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(caseWindow);
                caseWindow.show();
            } else {
                relatedItemComboBox.focus();
            }
        }
    });

    clearBtn = new Button(null, FontAwesome.TRASH_O);
    clearBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    clearBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            try {
                PropertyUtils.setProperty(RelatedEditItemField.this.bean, "typeid", null);
            } catch (Exception e) {
                LOG.error("Error while saving type", e);
            }
        }
    });
}

From source file:com.esofthead.mycollab.module.crm.view.account.AccountEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {

    if (Account.Field.type.equalTo(propertyId)) {
        return new AccountTypeComboBox();
    } else if (Account.Field.industry.equalTo(propertyId)) {
        return new IndustryComboBox();
    } else if (Account.Field.assignuser.equalTo(propertyId)) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    } else if (Account.Field.description.equalTo(propertyId)) {
        return new RichTextEditField();
    } else if (Account.Field.billingcountry.equalTo(propertyId)
            || Account.Field.shippingcountry.equalTo(propertyId)) {
        return new CountryComboBox();
    } else if (Account.Field.accountname.equalTo(propertyId)) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);//  ww w .  jav  a 2  s  .  c  o m
            tf.setRequiredError(AppContext.getMessage(AccountI18nEnum.ERROR_ACCOUNT_NAME_IS_NULL));
        }

        return tf;
    }

    return null;
}

From source file:com.esofthead.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java

License:Open Source License

private void addTextFieldSearch() {
    textValueField = new TextField();
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.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(UIConstants.DEFAULT_CONTROL_WIDTH);
        return typeCombo;
    } else if ("status".equals(propertyId)) {
        CampaignStatusComboBox statusCombo = new CampaignStatusComboBox();
        statusCombo.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return statusCombo;
    } else if ("campaignname".equals(propertyId)) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);//from w  w  w.ja v a 2  s . c o m
            tf.setRequiredError("Name must not be null");
        }

        return tf;
    } else if ("description".equals(propertyId)) {
        return new RichTextEditField();
    } 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.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")) {
        return new RichTextEditField();
    } else if (propertyId.equals("resolution")) {
        return new RichTextEditField();
    } else if (propertyId.equals("accountid")) {
        AccountSelectionField accountField = new AccountSelectionField();
        accountField.setRequired(true);/*  w w w .j a  v a2  s .  com*/
        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.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")) {
        return new AccountSelectionField();
    } else if (propertyId.equals("lastname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);//from  ww w .  jav a 2  s.c om
            tf.setRequiredError("Last name must not be null");
        }

        return tf;
    } else if (propertyId.equals("description")) {
        return new RichTextEditField();
    } else if (propertyId.equals("assignuser")) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    } else if (propertyId.equals("primcountry") || propertyId.equals("othercountry")) {
        return new CountryComboBox();
    } else if (propertyId.equals("birthday")) {
        return new DateComboboxSelectionField();
    }
    return null;
}

From source file:com.esofthead.mycollab.module.crm.view.contact.ContactSelectionField.java

License:Open Source License

public ContactSelectionField() {
    contactName = new TextField();
    contactName.setNullRepresentation("");
    contactName.setWidth("100%");
    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  w  w  .  j  a va2  s .  c  o m*/
        public void buttonClick(Button.ClickEvent clickEvent) {
            ContactSelectionWindow contactWindow = new ContactSelectionWindow(ContactSelectionField.this);
            UI.getCurrent().addWindow(contactWindow);
            contactWindow.show();
        }
    });

    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) {
            contactName.setValue("");
            contact = null;
        }
    });
}

From source file:com.esofthead.mycollab.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")) {
        return new CountryComboBox();
    } else if (propertyId.equals("status")) {
        return new LeadStatusComboBox();
    } else if (propertyId.equals("industry")) {
        return new IndustryComboBox();
    } else if (propertyId.equals("assignuser")) {
        return new ActiveUserComboBox();
    } else if (propertyId.equals("source")) {
        return new LeadSourceComboBox();
    } else if (propertyId.equals("lastname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);//from   w ww.  java2  s .c  om
            tf.setRequiredError("Last name must not be null");
        }

        return tf;
    } else if (propertyId.equals("description")) {
        return new RichTextEditField();
    } 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;
}