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:de.decidr.ui.view.AppointWorkflowAdminComponent.java

License:Apache License

/**
 * Adds a user to the form./*www  .  j  a  v a  2 s.c o m*/
 */
private void addUser() {
    userCounter += 1;
    appointForm.addField("user" + userCounter.toString(), new TextField("Username:"));
}

From source file:de.decidr.ui.view.InviteUserToTenantComponent.java

License:Apache License

/**
 * Adds a new field to the form of the component where the tenant admin can
 * insert the user's username or email address.
 *///w  w  w  .j  av a 2  s  .  co  m
private void addUser() {
    userCounter += 1;
    inviteForm.addField("user" + userCounter.toString(), new TextField("Username/email address:"));
    inviteForm.getField("user" + userCounter.toString()).setRequired(true);
}

From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java

License:Apache License

@Override
public Field createControl(String label, String value) {
    TextField field = new TextField(label);
    field.setImmediate(true);/*from  www  . j av a 2s  .  c o  m*/
    field.setValue(value);
    return field;
}

From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java

License:Apache License

@Override
public Field createControl(String label, String value) {
    TextField field = new TextField(label);
    field.addValidator(new FloatValidator("Please enter a valid float"));
    field.setImmediate(true);/*w  ww .ja v  a2 s . com*/
    field.setValue(value);
    return field;
}

From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java

License:Apache License

@Override
public Field createControl(String label, String value) {
    TextField field = new TextField(label);
    field.addValidator(new IntegerValidator("Please enter an Integer!"));
    field.setImmediate(true);/*from   w w w. j a v  a2  s.  c  o  m*/

    field.setValue(value);
    return field;
}

From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java

License:Apache License

@Override
public Field createControl(String label, String value) {
    TextField field = new TextField(label);
    field.addValidator(new AbstractValidator("Please enter time in the format hh:mm:ss.") {

        private static final long serialVersionUID = -2794593423408118150L;

        @Override/*from   www  .j a  v  a 2  s . c  om*/
        public boolean isValid(Object value) {
            String[] vals = ((String) value).split(":");
            if (vals == null || vals.length != 3) {
                return false;
            }
            try {
                int hour = Integer.parseInt(vals[0], 10);
                int minute = Integer.parseInt(vals[1], 10);
                int second = Integer.parseInt(vals[2], 10);
                return (hour >= 0 && hour < 24 && minute >= 0 && minute <= 60 && second >= 0);
            } catch (NumberFormatException e) {
                return false;
            }
        }
    });
    field.setImmediate(true);
    field.setValue(value);
    return field;
}

From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java

License:Apache License

public void addControl(Form form, DWDLSimpleVariableType type, String name, String label, String value,
        String hint) {/*from ww  w . j  a v a2  s  .  c  o  m*/

    FieldBuilder fieldBuilder = fieldBuilders.get(type);
    if (fieldBuilder != null) {
        Object control = fieldBuilder.createControl(label, value);
        if (control instanceof Field) {
            ((Field) control).setDescription(hint);
            form.addField(name, (Field) control);
        } else {
            ((AbstractComponent) control).setDescription(hint);
            ((AbstractComponent) control).setData(name);
            form.getLayout().addComponent((Component) control);
        }
    } else {
        // TODO Better error handling
        form.addField("error", new TextField("Unknown field type: " + type));
    }
}

From source file:de.decidr.ui.view.windows.WorkflowDescriptionWindow.java

License:Apache License

/**
 * Initializes the components./* ww  w. j a  v a 2s.  com*/
 */
private void init() {

    verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);
    buttonHorizontalLayout = new HorizontalLayout();
    buttonHorizontalLayout.setSpacing(true);
    verticalLayout.setSizeUndefined();

    nameTextField = new TextField("Name");
    nameTextField.setImmediate(true);
    descriptionTextField = new TextField("Description");

    okButton = new Button("OK", new CreateWorkflowModelAction(getNameTextField(), table));
    cancelButton = new Button("Cancel", new HideDialogWindowAction());

    verticalLayout.addComponent(nameTextField);
    nameTextField.setColumns(20);

    verticalLayout.addComponent(descriptionTextField);
    descriptionTextField.setColumns(20);
    descriptionTextField.setRows(5);

    verticalLayout.addComponent(buttonHorizontalLayout);

    buttonHorizontalLayout.addComponent(okButton);
    buttonHorizontalLayout.addComponent(cancelButton);

    this.setContent(verticalLayout);
    this.setResizable(false);
    this.setCaption("Workflow description");
    this.center();
    this.setModal(true);
}

From source file:de.decidr.ui.view.windows.FieldBuilder.java

License:Apache License

@Override
public Field createControl(TTaskItem taskItem, String value) {
    TextField field = new TextField(taskItem.getLabel());
    field.setImmediate(true);/*from ww w. jav a2 s  .  c o m*/
    field.setValue(value);
    return field;
}

From source file:de.decidr.ui.view.windows.FieldBuilder.java

License:Apache License

@Override
public Field createControl(TTaskItem taskItem, String value) {
    TextField field = new TextField(taskItem.getLabel());
    field.addValidator(new FloatValidator("Please enter a valid float"));
    field.setImmediate(true);//from   w ww  .j a  v a 2 s . c  om
    field.setValue(value);
    return field;
}