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(ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextField with a value change listener.

Usage

From source file:com.klwork.explorer.ui.form.LongFormPropertyRenderer.java

License:Apache License

@Override
public Field getPropertyField(FormProperty formProperty) {
    final TextField textField = new TextField(getPropertyLabel(formProperty));
    textField.setRequired(formProperty.isRequired());
    textField.setEnabled(formProperty.isWritable());
    textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));

    if (formProperty.getValue() != null) {
        textField.setValue(formProperty.getValue());
    }//from  w  w w.ja v a2s  .  c  o m

    // Add validation of numeric value
    textField.addValidator(new LongValidator("Value must be a long"));
    textField.setImmediate(true);

    return textField;
}

From source file:com.klwork.explorer.ui.form.StringFormPropertyRenderer.java

License:Apache License

@Override
public Field getPropertyField(FormProperty formProperty) {
    TextField textField = new TextField(getPropertyLabel(formProperty));
    textField.setRequired(formProperty.isRequired());
    textField.setEnabled(formProperty.isWritable());
    textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));

    if (formProperty.getValue() != null) {
        textField.setValue(formProperty.getValue());
    }//from w  ww  .j  a v a 2  s.c  om

    return textField;
}

From source file:com.klwork.explorer.ui.task.NewTaskPopupWindow.java

License:Apache License

protected void initForm() {
    form = new Form();
    form.setValidationVisibleOnCommit(true);
    form.setImmediate(true);/*from w ww  .jav  a2s  . c om*/
    setContent(form);
    // addComponent(form);

    // name
    nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
    nameField.focus();
    nameField.setRequired(true);
    nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED));
    form.addField("name", nameField);

    // description
    descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
    descriptionArea.setColumns(25);
    form.addField("description", descriptionArea);

    // duedate
    dueDateField = new DateField(i18nManager.getMessage(Messages.TASK_DUEDATE));
    dueDateField.setResolution(DateField.RESOLUTION_DAY);
    form.addField("duedate", dueDateField);

    // priority
    priorityComboBox = new PriorityComboBox(i18nManager);
    form.addField("priority", priorityComboBox);
}

From source file:com.klwork.explorer.ui.task.NewTodoToTaskPopupWindow.java

License:Apache License

@Override
protected void initFormSubComponent() {
    // name//  w  w w  .  ja  v  a  2  s .  c  o  m
    nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
    nameField.setValue(relTodo.getName());
    nameField.focus();
    nameField.setRequired(true);
    nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED));
    getForm().addComponent(nameField);

    // description
    descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
    if (StringTool.judgeBlank(relTodo.getDescription())) {
        descriptionArea.setValue(relTodo.getDescription());
    }
    descriptionArea.setColumns(25);
    // form.addField("description", descriptionArea);
    getForm().addComponent(descriptionArea);
    // duedate
    dueDateField = CommonFieldHandler.createDateField(i18nManager.getMessage(Messages.TASK_DUEDATE), false);
    if (StringTool.judgeBlank(relTodo.getCompletionDate())) {
        dueDateField.setValue(relTodo.getCompletionDate());
    }
    // form.addField("duedate", dueDateField);
    getForm().addComponent(dueDateField);

    // priority
    priorityComboBox = new PriorityComboBox(i18nManager);
    // form.addField("priority", priorityComboBox);
    getForm().addComponent(priorityComboBox);
    //
    String defaultTeam = null;
    if (StringTool.judgeBlank(relTodo.getAssignedTeam())) {
        defaultTeam = relTodo.getAssignedTeam();
    }
    userGroupComboBox = help.getUserOfTeamComboBox("", defaultTeam);
    //userGroupComboBox.
    userGroupComboBox.addValueChangeListener(new com.vaadin.data.Property.ValueChangeListener() {
        /**
         * 
         */
        private static final long serialVersionUID = -3864934875844211279L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Object o = event.getProperty().getValue();
            changeUserSelect(o.toString());
        }

    });
    getForm().addComponent(userGroupComboBox);

    String defaultUser = null;
    //
    if (StringTool.judgeBlank(relTodo.getAssignedUser())) {
        defaultUser = relTodo.getAssignedUser();
    }

    Map<String, String> usersMap = new HashMap();
    usersMap.put("", i18nManager.getMessage(Messages.SELECT_DEFAULT));
    userComboBox = CommonFieldHandler.createComBox(i18nManager.getMessage(Messages.TEAM_MEMBER_SELECT),
            usersMap, defaultUser);
    getForm().addComponent(userComboBox);

    initCreateTaskButton();
    initEnterKeyListener();
}

From source file:com.liferay.mail.vaadin.AccountEditor.java

License:Open Source License

private void createComponents() {

    addressField = new TextField(Lang.get("email-address"));
    addressField.focus();/* w w w. j a va 2 s.  c om*/
    loginField = new TextField(Lang.get("login"));
    personalNameField = new TextField(Lang.get("personal-name"));
    passwordField = new TextField(Lang.get("password"));
    passwordField.setSecret(true);
    passwordSavedCheckBox = new CheckBox(Lang.get("save-password"));
    mailInHostNameField = new TextField(Lang.get("incoming-imap-server"));
    mailInPortCombo = new ComboBox(Lang.get("incoming-port"),
            controller.getConfigurationManager().getIncomingPorts());
    mailInSecureCheckBox = new CheckBox(Lang.get("use-secure-incoming-connection"));
    mailOutHostNameField = new TextField(Lang.get("outgoing-smtp-server"));
    mailOutPortCombo = new ComboBox(Lang.get("outgoing-port"),
            controller.getConfigurationManager().getOutgoingPorts());
    mailOutSecureCheckBox = new CheckBox(Lang.get("use-secure-outgoing-connection"));

    // initial validation - the account is then tested
    addressField.setRequired(true);
    mailInHostNameField.setRequired(true);
    mailOutHostNameField.setRequired(true);

    addComponent(addressField);
    if (!useLocalPartOfEmailAddressAsLogin) {
        addComponent(loginField);
    }
    addComponent(personalNameField);
    addComponent(passwordField);
    addComponent(passwordSavedCheckBox);
    if (!hideSettings) {
        addComponent(mailInHostNameField);
        addComponent(mailInPortCombo);
        addComponent(mailInSecureCheckBox);
        addComponent(mailOutHostNameField);
        addComponent(mailOutPortCombo);
        addComponent(mailOutSecureCheckBox);
    }

    HorizontalLayout footer = new HorizontalLayout();
    footer.setSpacing(true);
    okButton = new Button(Lang.get("save"));
    okButton.setStyleName("primary");
    okButton.addListener(this);
    footer.addComponent(okButton);
    cancelButton = new Button(Lang.get("cancel"));
    cancelButton.addListener(this);
    footer.addComponent(cancelButton);

    // TODO add footer to layout in a cleaner manner
    addComponent(footer);
}

From source file:com.liferay.vaadin.poc.ui.PortletUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    setContent(layout);//from   ww w. ja v a2 s  . c om
    notes = new BeanItemContainer<Note>(Note.class);

    notes.addBean(new Note(noteCounter++, new Date(), "example note"));

    table = new Table("Notes", notes);
    table.setVisibleColumns(new Object[] { "time", "text" });
    table.setPageLength(7);
    table.setBuffered(false);
    table.setSelectable(true);
    table.setWidth(100, Unit.PERCENTAGE);

    textField = new TextField("Text");
    textField.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(textField);

    Button addButton = new Button("Add");
    addButton.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(addButton);
    removeButton = new Button("Remove");
    removeButton.setWidth(100, Unit.PERCENTAGE);
    removeButton.setEnabled(false);
    layout.addComponent(removeButton);

    layout.addComponent(table);

    addButton.addClickListener((event) -> {
        notes.addBean(new Note(noteCounter++, new Date(), textField.getValue()));
    });

    removeButton.addClickListener((event) -> {
        if (selectedNote != null) {
            notes.removeItem(selectedNote);
            selectedNote = null;
        }
        removeButton.setEnabled(selectedNote != null);
    });

    // Handle selection change.
    table.addValueChangeListener((event) -> {
        selectedNote = (Note) table.getValue();
        removeButton.setEnabled(selectedNote != null);
    });
}

From source file:com.lizardtech.expresszip.vaadin.ExportOptionsViewComponent.java

License:Apache License

public ExportOptionsViewComponent(ExportProps exportProps) {

    this.exportProps = exportProps;

    listeners = new ArrayList<ExportOptionsViewListener>();
    txtJobName = new TextField(JOB_NAME);
    txtEmail = new TextField(EMAIL_ADDRESS);
    txtUserNotation = new TextField(JOB_USER_NOTATION);
    numTilesLabel = new Label();
    exportSizeEstimate = new Label();
    outputFormatComboBox = new ComboBox(OUTPUT_FORMAT, OUTPUT_FORMATS);
    outputFormatComboBox.setTextInputAllowed(false);
    outputFormatComboBox.addListener(griddingValuesChangeListener);

    setSizeFull();/*  w  ww  . ja  v a 2s . co m*/

    /**
     * Setup output resolution
     */

    exportSizeComboBox = new ComboBox(null, exportSizes);
    exportSizeComboBox.setNullSelectionAllowed(false);
    exportSizeComboBox.setNewItemsAllowed(false);
    exportSizeComboBox.setTextInputAllowed(false);
    exportSizeComboBox.setImmediate(true);
    exportSizeComboBox.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            Object choice = event.getProperty().getValue();
            String value = "";
            if (SMALL.equals(choice)) {
                gridCheckbox.setValue(Boolean.FALSE);
                gridCheckbox.setEnabled(false);
                value = "512";
            } else if (MEDIUM.equals(choice)) {
                gridCheckbox.setValue(Boolean.FALSE);
                gridCheckbox.setEnabled(false);
                value = "1280";
            } else if (LARGE.equals(choice)) {
                gridCheckbox.setValue(Boolean.FALSE);
                gridCheckbox.setEnabled(false);
                value = "5000";
            }

            boolean custom = CUSTOM.equals(choice);
            if (!custom) {
                if (NATIVE.equals(choice)) {
                    txtGroundResolution.setValue(Double.toString(maximumResolution));
                } else {
                    if (getExportProps().getAspectRatio() > 1.0d) {
                        txtDimHeight.setValue(value);
                    } else
                        txtDimWidth.setValue(value);
                }
            }

            txtDimWidth.setEnabled(custom);
            txtDimHeight.setEnabled(custom);
            txtGroundResolution.setEnabled(custom);
        }
    });

    // Add Output Resolution to view
    HorizontalLayout dimensionsLayout = new HorizontalLayout();
    dimensionsLayout.addComponent(txtDimWidth);
    dimensionsLayout.addComponent(txtDimHeight);
    dimensionsLayout.setSpacing(true);
    dimensionsLayout.setWidth("100%");

    // Format dimensions layout
    txtDimHeight.setMaxLength(10);
    txtDimHeight.setWidth("100%");
    txtDimHeight.setImmediate(true);
    txtDimHeight.addListener(heightValChangeListener);
    txtDimHeight.setRequired(true);
    txtDimHeight.addValidator(new WidthHeightValidator());

    txtDimWidth.setMaxLength(10);
    txtDimWidth.setWidth("100%");
    txtDimWidth.setImmediate(true);
    txtDimWidth.addListener(widthValChangeListener);
    txtDimWidth.setRequired(true);
    txtDimWidth.addValidator(new WidthHeightValidator());

    // Format Ground Resolution layout
    txtGroundResolution.setValue("0");
    txtGroundResolution.setImmediate(true);
    txtGroundResolution.addListener(groundResValChangeListener);
    txtGroundResolution.setRequired(true);
    txtGroundResolution.addValidator(new GroundResolutionValidator());

    vrtOutputResolution = new VerticalLayout();
    vrtOutputResolution.setSpacing(true);
    vrtOutputResolution.addComponent(exportSizeComboBox);
    vrtOutputResolution.addComponent(dimensionsLayout);
    txtGroundResolution.setWidth("75%");
    vrtOutputResolution.addComponent(txtGroundResolution);
    vrtOutputResolution.setComponentAlignment(txtGroundResolution, Alignment.BOTTOM_CENTER);

    /**
     * Setup Gridding options
     */

    // Add Gridding option to view
    griddingLayout = new VerticalLayout();
    griddingLayout.setSpacing(true);

    // Format GridCheckbox layout
    griddingLayout.addComponent(gridCheckbox);
    gridCheckbox.setImmediate(true);
    gridCheckbox.setValue(false);
    gridCheckbox.addListener(griddingModeChangeListener);

    xPixelsTextBox.setWidth("100%");
    xPixelsTextBox.setImmediate(true);
    xPixelsTextBox.addValidator(new TileWidthValidator());
    xPixelsTextBox.addListener(griddingValuesChangeListener);

    yPixelsTextBox.setWidth("100%");
    yPixelsTextBox.setImmediate(true);
    yPixelsTextBox.addValidator(new TileHeightValidator());
    yPixelsTextBox.addListener(griddingValuesChangeListener);

    xDistanceTextBox.setWidth("100%");
    xDistanceTextBox.setImmediate(true);
    xDistanceTextBox.addValidator(new TileGeoXValidator());
    xDistanceTextBox.addListener(griddingValuesChangeListener);

    yDistanceTextBox.setWidth("100%");
    yDistanceTextBox.setImmediate(true);
    yDistanceTextBox.addValidator(new TileGeoYValidator());
    yDistanceTextBox.addListener(griddingValuesChangeListener);

    // Format gridding options
    xTilesTextBox.setWidth("100%");
    xTilesTextBox.setImmediate(true);
    xTilesTextBox.addValidator(new TileXDivisorValidator());
    xTilesTextBox.addListener(griddingValuesChangeListener);

    yTilesTextBox.setWidth("100%");
    yTilesTextBox.setImmediate(true);
    yTilesTextBox.addValidator(new TileYDivisorValidator());
    yTilesTextBox.addListener(griddingValuesChangeListener);

    optGridOpt.setValue(GRID_TILE_DIMENSIONS);
    optGridOpt.setImmediate(true);
    optGridOpt.addListener(griddingModeChangeListener);

    HorizontalLayout hznGridOptions = new HorizontalLayout();
    griddingLayout.addComponent(hznGridOptions);
    hznGridOptions.setWidth("100%");
    hznGridOptions.setSpacing(true);
    hznGridOptions.addComponent(optGridOpt);

    VerticalLayout vrtGridComboFields = new VerticalLayout();
    hznGridOptions.addComponent(vrtGridComboFields);
    vrtGridComboFields.setWidth("100%");
    hznGridOptions.setExpandRatio(vrtGridComboFields, 1.0f);

    HorizontalLayout hznTileDim = new HorizontalLayout();
    hznTileDim.setWidth("100%");
    vrtGridComboFields.addComponent(hznTileDim);
    hznTileDim.addComponent(xPixelsTextBox);
    hznTileDim.addComponent(yPixelsTextBox);

    HorizontalLayout hznDistanceDim = new HorizontalLayout();
    hznDistanceDim.setWidth("100%");
    vrtGridComboFields.addComponent(hznDistanceDim);
    hznDistanceDim.addComponent(xDistanceTextBox);
    hznDistanceDim.addComponent(yDistanceTextBox);

    HorizontalLayout hznDivideGrid = new HorizontalLayout();
    hznDivideGrid.setWidth("100%");
    vrtGridComboFields.addComponent(hznDivideGrid);
    hznDivideGrid.addComponent(xTilesTextBox);
    hznDivideGrid.addComponent(yTilesTextBox);
    hznDivideGrid.setSpacing(true);
    hznTileDim.setSpacing(true);
    hznDistanceDim.setSpacing(true);

    /**
     * Format options panel
     */

    // Add Format options to view
    formatOptionsLayout = new VerticalLayout();
    formatOptionsLayout.setWidth("100%");
    formatOptionsLayout.setSpacing(true);
    formatOptionsLayout.setMargin(true);

    // Format outputformat
    formatOptionsLayout.addComponent(outputFormatComboBox);

    outputFormatComboBox.setNullSelectionAllowed(false);

    formatOptionsLayout.addComponent(packageComboBox);
    packageComboBox.addItem(ExportProps.OutputPackageFormat.TAR);
    packageComboBox.addItem(ExportProps.OutputPackageFormat.ZIP);
    packageComboBox.setNullSelectionAllowed(false);
    packageComboBox.setTextInputAllowed(false);
    packageComboBox.setValue(ExportProps.OutputPackageFormat.ZIP);

    /**
     * Job Details
     */

    // Set Jobname panel
    jobDetailsLayout = new VerticalLayout();
    jobDetailsLayout.setSpacing(true);
    jobDetailsLayout.setMargin(true);

    jobDetailsLayout.addComponent(txtJobName);
    txtJobName.setRequired(true);
    txtJobName.setRequiredError("Please enter a job name.");
    txtJobName.setWidth("100%");
    txtJobName.setImmediate(true);
    String jobname_regexp = "^[ A-Za-z0-9._-]{1,128}$";
    txtJobName.addValidator(new RegexpValidator(jobname_regexp,
            "Job names should be alpha-numeric, less than 128 characters and may include spaces, dashes and underscores"));
    txtJobName.addValidator(new JobNameUniqueValidator(
            "A job by that name already exists in your configured export directory"));
    txtJobName.addListener(resolutionValuesChangeListener);

    jobDetailsLayout.addComponent(txtUserNotation);
    txtUserNotation.setWidth("100%");
    txtUserNotation.setImmediate(true);
    String usernotation_regexp = "^[ A-Za-z0-9_-]{0,32}$";
    txtUserNotation.addValidator(new RegexpValidator(usernotation_regexp,
            "User names should be alpha-numeric, less than 32 characters and may include spaces, dashes and underscores"));
    txtUserNotation.addListener(resolutionValuesChangeListener);

    // Format Email
    boolean enableEmail = new BackgroundExecutor.Factory().getBackgroundExecutor().getMailServices()
            .isValidEmailConfig();
    txtEmail.setEnabled(enableEmail);
    if (enableEmail) {
        jobDetailsLayout.addComponent(txtEmail);
        txtEmail.setWidth("100%");
        txtEmail.setInputPrompt("enter your email address");
        txtEmail.setImmediate(true);
        txtEmail.addValidator(new EmailValidator("Invalid format for email address."));
        txtEmail.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                updateSubmitEnabledState();
            }
        });
    }

    VerticalLayout exportSummary = new VerticalLayout();
    exportSummary.addComponent(numTilesLabel);
    exportSummary.addComponent(exportSizeEstimate);
    jobDetailsLayout.addComponent(new Panel(("Export summary"), exportSummary));

    // Set submit and back buttons
    // Add listeners to all fields
    backButton = new ExpressZipButton("Back", Style.STEP);
    backButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            ((ExpressZipWindow) getApplication().getMainWindow()).regressToPrev();
        }
    });

    submitButton = new ExpressZipButton("Submit", Style.STEP);
    submitButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                txtJobName.validate();
            } catch (InvalidValueException e) {
                txtJobName.requestRepaint();
                updateSubmitEnabledState();
                return;
            }
            for (ExportOptionsViewListener listener : listeners) {
                listener.submitJobEvent(getExportProps());
            }
        }
    });

    accordian = new Accordion();
    accordian.addStyleName("expresszip");
    accordian.setImmediate(true);
    accordian.addTab(jobDetailsLayout, JOB_DETAILS);
    accordian.addTab(formatOptionsLayout, FORMAT_OPTIONS);
    accordian.setSizeFull();

    outputDetails = new VerticalLayout();
    outputDetails.setMargin(true);
    outputDetails.setSpacing(true);
    outputDetails.addComponent(new Panel(DIMENSIONS, vrtOutputResolution));
    outputDetails.addComponent(new Panel(TILING, griddingLayout));
    accordian.addTab(outputDetails, EXPORT_CONFIGURATION);

    HorizontalLayout backSubmitLayout = new HorizontalLayout();
    backSubmitLayout.setWidth("100%");
    backSubmitLayout.addComponent(backButton);
    backSubmitLayout.addComponent(submitButton);
    backSubmitLayout.setComponentAlignment(backButton, Alignment.BOTTOM_LEFT);
    backSubmitLayout.setComponentAlignment(submitButton, Alignment.BOTTOM_RIGHT);

    VerticalLayout navLayout = new VerticalLayout();
    navLayout.addComponent(backSubmitLayout);
    navLayout.setSpacing(true);

    ThemeResource banner = new ThemeResource("img/ProgressBar3.png");
    navLayout.addComponent(new Embedded(null, banner));

    // add scrollbars around formLayout
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSizeFull();
    layout.setSpacing(true);

    Label step = new Label("Step 3: Configure Export Options");
    step.addStyleName("step");
    layout.addComponent(step);

    layout.addComponent(accordian);
    layout.setExpandRatio(accordian, 1.0f);

    layout.addComponent(navLayout);
    layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER);

    setCompositionRoot(layout);

    outputFormatComboBox.select(OUTPUT_FORMATS.get(0));

    forceGriddingCheck();
    updateGriddingEnabledState();
}

From source file:com.logicbomb.newschool.MyAppWidgetSet.LoginWidget.java

public LoginWidget() {
    setMargin(true);//  w ww  .j av a2  s.  c o m
    setSpacing(true);

    Panel iPanel = new Panel();
    iPanel.addStyleName("backColorWhite");
    iPanel.setSizeUndefined();

    addComponent(iPanel);

    TextField iTextField = new TextField("Username");
    iTextField.setWidth("300px");
    iTextField.setRequired(true);
    iTextField.setInputPrompt("Your username (eg. joe@email.com)");
    iTextField.setIcon(FontAwesome.USER);
    iTextField.addValidator(new EmailValidator("Username must be an email address"));
    iTextField.setInvalidAllowed(true);
    iTextField.focus();

    PasswordField iPasswordField = new PasswordField("Password");
    iPasswordField.setIcon(FontAwesome.KEY);
    iPasswordField.setWidth("300px");
    iPasswordField.setRequired(true);
    iPasswordField.setValue("");
    iPasswordField.setNullRepresentation("");

    Button iButton = new Button("Login");
    iButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            addComponent(new Label("Login Successfully"));
        }
    });

    FormLayout iFormLayout = new FormLayout();
    iFormLayout.setSpacing(true);
    iFormLayout.setMargin(true);
    iFormLayout.addComponent(iTextField);
    iFormLayout.addComponent(iPasswordField);
    iFormLayout.addComponent(iButton);
    iPanel.setContent(iFormLayout);

}

From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java

License:Open Source License

private VerticalLayout createUserDataSection(LspsUI ui, Person user) {
    VerticalLayout userData = new VerticalLayout();

    Label userDataHeader = new Label("<h2>" + ui.getMessage("settings.userSection") + "</h2>",
            ContentMode.HTML);/*from   w  w w.  j a  v  a  2 s. co  m*/
    userData.addComponent(userDataHeader);

    FormLayout userDataContent = new FormLayout();

    if ((userRights.contains(OsRights.CHANGE_OWN_PASSWORD)) || (userRights.contains(OsRights.MANAGE_PERSON))) {
        this.passwordField = new PasswordField(ui.getMessage("settings.password"));
        passwordField.setWidth("100%");
        userDataContent.addComponent(passwordField);

        this.confirmation = new PasswordField(ui.getMessage("settings.passwordVerification"));
        confirmation.setWidth("100%");
        userDataContent.addComponent(confirmation);
    }

    this.email = new TextField(ui.getMessage("settings.email"));
    email.setWidth("100%");
    email.setValue(user.getEmail());
    email.setNullRepresentation("");
    userDataContent.addComponent(email);

    this.telephone = new TextField(ui.getMessage("settings.phoneNumber"));
    telephone.setWidth("100%");
    telephone.setValue(user.getPhone());
    telephone.setNullRepresentation("");
    userDataContent.addComponent(telephone);

    userData.addComponent(userDataContent);
    return userData;
}

From source file:com.m1kah.ui.UiFactory.java

License:Open Source License

public static TextField createTextField(String caption) {
    TextField textField = new TextField(caption);
    textField.setImmediate(true);//  www  . java2 s  .  co m
    return textField;
}