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.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")) {
        return new CountryListSelect();
    } else if (propertyId.equals("status")) {
        return new LeadStatusListSelect();
    } else if (propertyId.equals("industry")) {
        return new IndustryListSelect();
    } else if (propertyId.equals("assignuser")) {
        return new ActiveUserComboBox();
    } else if (propertyId.equals("source")) {
        return new LeadSourceListSelect();
    } else if (propertyId.equals("lastname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);/*from w w  w  . j av a 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")) {
        MTextField txtField = new MTextField();
        if (isValidateForm) {
            txtField.withNullRepresentation("").withRequired(true)
                    .withRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
                            UserUIContext.getMessage(AccountI18nEnum.FORM_ACCOUNT_NAME)));
        }

        return txtField;
    }

    return null;
}

From source file:com.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);//from w  ww  .j av a  2  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")) {
        return new CurrencyComboBoxField();
    } else if (propertyId.equals("salesstage")) {
        return new OpportunitySalesStageListSelect();
    } else if (propertyId.equals("opportunitytype")) {
        return new OpportunityTypeListSelect();
    } else if (propertyId.equals("source")) {
        return new LeadSourceListSelect();
    } else if (propertyId.equals("description")) {
        return new MTextArea();
    } else if (propertyId.equals("assignuser")) {
        return new ActiveUserComboBox();
    }

    return null;
}

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

License:Open Source License

public RelatedEditItemField(Object bean) {
    this.bean = bean;

    relatedItemComboBox = new RelatedItemComboBox();
    itemField = new TextField();
    itemField.setEnabled(true);//w  ww  . ja  v a2  s.  c om

    browseBtn = new MButton("", clickEvent -> {
        String type = (String) relatedItemComboBox.getValue();
        if (CrmTypeConstants.ACCOUNT.equals(type)) {
            AccountSelectionWindow accountWindow = new AccountSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(accountWindow);
            accountWindow.show();
        } else if (CrmTypeConstants.CAMPAIGN.equals(type)) {
            CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(campaignWindow);
            campaignWindow.show();
        } else if (CrmTypeConstants.CONTACT.equals(type)) {
            ContactSelectionWindow contactWindow = new ContactSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(contactWindow);
            contactWindow.show();
        } else if (CrmTypeConstants.LEAD.equals(type)) {
            LeadSelectionWindow leadWindow = new LeadSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(leadWindow);
            leadWindow.show();
        } else if (CrmTypeConstants.OPPORTUNITY.equals(type)) {
            OpportunitySelectionWindow opportunityWindow = new OpportunitySelectionWindow(
                    RelatedEditItemField.this);
            UI.getCurrent().addWindow(opportunityWindow);
            opportunityWindow.show();
        } else if (CrmTypeConstants.CASE.equals(type)) {
            CaseSelectionWindow caseWindow = new CaseSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(caseWindow);
            caseWindow.show();
        } else {
            relatedItemComboBox.focus();
        }
    }).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    clearBtn = new MButton("", clickEvent -> {
        try {
            PropertyUtils.setProperty(bean, "typeid", null);
            PropertyUtils.setProperty(bean, "type", null);
            relatedItemComboBox.setValue(null);
            itemField.setValue("");
        } catch (Exception e) {
            LOG.error("Error while saving type", e);
        }
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
}

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

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("AccountSearchName", ShortcutAction.KeyCode.ENTER, null) {
                @Override//from  w w  w  .j a  va2 s .co  m
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPanel.addComponent(textValueField, 0, 0);
    layoutSearchPanel.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

From source file:com.mycollab.module.crm.view.campaign.CampaignSimpleSearchPanel.java

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("CampaignSearchField", ShortcutAction.KeyCode.ENTER, null) {
                @Override// w w  w  .j  a v a 2s.  co m
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

From source file:com.mycollab.module.crm.view.cases.CaseSimpleSearchPanel.java

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("CaseSearchRequest", ShortcutAction.KeyCode.ENTER, null) {
                @Override/* ww  w.  j a  v a 2s . co m*/
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

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

License:Open Source License

public ContactSelectionField() {
    contactName = new TextField();
    contactName.setNullRepresentation("");
    contactName.setWidth("100%");
    browseBtn = new MButton("", clickEvent -> {
        ContactSelectionWindow contactWindow = new ContactSelectionWindow(ContactSelectionField.this);
        UI.getCurrent().addWindow(contactWindow);
        contactWindow.show();// w w w.  j a v a2 s.c  om
    }).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    clearBtn = new MButton("", clickEvent -> {
        contactName.setValue("");
        contact = null;
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
}

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

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("ContactSearchRequest", ShortcutAction.KeyCode.ENTER, null) {
                @Override/*from   w w  w.  ja v a 2 s  .  c o  m*/
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

From source file:com.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  w  w.  ja  v  a 2 s  .  c  o m*/
            tf.setRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
                    UserUIContext.getMessage(GenericI18Enum.FORM_LASTNAME)));
        }

        return tf;
    } else if (propertyId.equals("description")) {
        return new RichTextArea();
    } else if (propertyId.equals("accountname")) {
        TextField txtField = new TextField();
        if (isValidateForm) {
            txtField.setRequired(true);
            txtField.setRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
                    UserUIContext.getMessage(LeadI18nEnum.FORM_ACCOUNT_NAME)));
        }

        return txtField;
    }

    return null;
}

From source file:com.mycollab.module.crm.view.lead.LeadSimpleSearchPanel.java

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("LeadSearchRequest", ShortcutAction.KeyCode.ENTER, null) {
                @Override//from www.jav  a 2  s .c  o  m
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    searchPanel.addComponent(textValueField, 0, 0);
    searchPanel.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}