anchor.diff:  .[classname]#TextField# Example
   image::img/textfield-example.png[width=40%, scaledwidth=50%]
   
  -Value changes are handled with a [classname]#Property.ValueChangeListener#, as
  -in most other fields. The value can be acquired with [methodname]#getValue()#
  -directly from the text field, as is done in the example below, or from the
  -property reference of the event.
  +Value changes are handled by adding a listener using either the [methodname]#onChange()#
  +or [methodname]#addValueChangeListener()# method, as in most other fields. The value can be
  +acquired with [methodname]#getValue()# directly from the text field or from the parameter
  +passed to the event listener. 
   
   [source, java]
   ----
   // Handle changes in the value
  -tf.addValueChangeListener(new Property.ValueChangeListener() {
  -    public void valueChange(ValueChangeEvent event) {
  -        // Assuming that the value type is a String
  -        String value = (String) event.getProperty().getValue();
  -
  +tf.addValueChangeListener(event ->
           // Do something with the value
  -        Notification.show("Value is: " + value);
  -    }
  -});
  -
  -// Fire value changes immediately when the field loses focus
  -tf.setImmediate(true);
  +        Notification.show("Value is: " + event.getValue()));
   ----
   See the http://demo.vaadin.com/book-examples-vaadin7/book#component.textfield.inputhandling[on-line example, window="_blank"].
   
  -As with other event listeners, you can use lambda expression with one parameter
  -to handle the events in Java 8.
  +[classname]#TextField# edits [classname]#String# values, but you can use [classname]#Binder#
  +to bind it to any property type that has a proper converter, as described in
  +<<dummy/../../../framework/datamodel/datamodel-properties#datamodel.properties.converter,"Converting
  +Between Property Type and Representation">>.
   
   Much of the API of [classname]#TextField# is defined in
   [classname]#AbstractTextField#, which allows different kinds of text input
  
positive.code: [[figure.components.textfield.api]]
  .Text Field Class Relationships
  image::img/textfield-diagram-hi.png[width=40%, scaledwidth=70%]
  
  [[components.textfield.databinding]]
  == Data Binding
  
  [classname]#TextField# edits [classname]#String# values, but you can bind it to
  any property type that has a proper converter, as described in
  <<dummy/../../../framework/datamodel/datamodel-properties#datamodel.properties.converter,"Converting
  Between Property Type and Representation">>.
  
  [source, java]
  ----
  // Have an initial data model. As Double is unmodificable and
  // doesn't support assignment from String, the object is
  // reconstructed in the wrapper when the value is changed.
  Double trouble = 42.0;
  
  // Wrap it in a property data source
  final ObjectProperty<Double> property =
      new ObjectProperty<Double>(trouble);
  
  // Create a text field bound to it
  // (StringToDoubleConverter is used automatically)
  TextField tf = new TextField("The Answer", property);
  tf.setImmediate(true);
  
  // Show that the value is really written back to the
  // data source when edited by user.
  Label feedback = new Label(property);
  feedback.setCaption("The Value");
  ----
  See the http://demo.vaadin.com/book-examples-vaadin7/book#component.textfield.databinding[on-line example, window="_blank"].
  
  When you put a [classname]#Table# in editable mode or create fields with a
  [classname]#FieldGroup#, the [classname]#DefaultFieldFactory# creates a
  [classname]#TextField# for almost every property type by default. You often need
  to make a custom factory to customize the creation and to set the field tooltip,
  validation, formatting, and so on.
  
  See
  <<dummy/../../../framework/datamodel/datamodel-overview.asciidoc#datamodel.overview,"Binding
  Components to Data">> for more details on data binding, field factories for
  [classname]#Table# in
  <<dummy/../../../framework/components/components-table#components.table.editing,"Editing
  the Values in a Table">>, and
  <<dummy/../../../framework/datamodel/datamodel-itembinding#datamodel.itembinding,"Creating
  Forms by Binding Fields to Items">> regarding forms.
  
  [[components.textfield.length]]
  == String Length
  
negative.code: width of a letter and varies by browser and operating system. There is no standard
  way in HTML for setting the width exactly to a number of letters (in a monospaced font).
  
  [[components.textfield.textchangeevents]]
  == Configuring the Granularity of Value Change Events
  
  ((("[classname]#Text change events#", id="term.components.textfield.textchangeevents", range="startofrange")))
  
  Often you want to control how frequently [classname]#TextField# value changes are transmitted to the server.
  Sometimes the changes should be sent only after the field loses focus.
  In the other extreme, it can sometimes be useful to receive events every time the user presses a key.
  
  The __value change event mode__ defines how quickly the changes are transmitted
  to the server and cause a server-side event. Lazier change events allow sending
  larger changes in one event if the user is typing fast, thereby reducing server
  requests.
  