aboutsummaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-05 11:28:45 +0300
committerArtur Signell <artur@vaadin.com>2016-08-05 11:45:42 +0300
commit138f8ddb6927f66bc2d5bfce6d7ae5963c0ca42e (patch)
tree4a852887ce13034c6b0d1a374ca16c43585d4de0 /documentation
parent4f2a8f149bf154235aabd7b8a9eae74170f68d5e (diff)
downloadvaadin-framework-138f8ddb6927f66bc2d5bfce6d7ae5963c0ca42e.tar.gz
vaadin-framework-138f8ddb6927f66bc2d5bfce6d7ae5963c0ca42e.zip
Update documentation to match API in vol2
Change-Id: I7514105d817a8e442ecdc81fa77af758a9abfd08
Diffstat (limited to 'documentation')
-rw-r--r--documentation/components/components-fields.asciidoc22
-rw-r--r--documentation/components/components-grid.asciidoc2
2 files changed, 12 insertions, 12 deletions
diff --git a/documentation/components/components-fields.asciidoc b/documentation/components/components-fields.asciidoc
index e1855de32f..b839b7f729 100644
--- a/documentation/components/components-fields.asciidoc
+++ b/documentation/components/components-fields.asciidoc
@@ -67,7 +67,7 @@ displayed in a tooltip when the mouse pointer hovers over the error indicator.
== Handling Field Value Changes
[classname]#Field# provides two methods for listening to changes to the field value:
-[methodname]#onValueChange# and [methodname]#addValueChangeListener#. The difference
+[methodname]#onChange# and [methodname]#addValueChangeListener#. The difference
is that the former takes a [interfacename]#Consumer# object that only receives the new value;
the latter, on the other hand, takes an [interfacename]#EventListener# that gets
a [classname]#ValueChange# event instance containing extra information about the event.
@@ -81,14 +81,14 @@ TextField textField = new TextField();
Label echo = new Label();
// Just echo in the label anything the user enters
-textField.onValueChange(echo::setValue);
+textField.onChange(echo::setValue);
// Add a more complex listener
textField.addValueChangeListener(event -> {
String origin = event.isUserOriginated()
? "user"
: "application";
- String message = origin
+ String message = origin
+ " entered the following: "
+ event.getValue();
Notification.show(message);
@@ -118,7 +118,7 @@ Binder<Person> binder = new Binder<>();
// Bind nameField to the Person.name property
// by specifying its getter and setter
-binder.addField(nameField)
+binder.forField(nameField)
.bind(Person::getName, Person::setName);
// Bind an actual concrete Person instance.
@@ -133,13 +133,13 @@ binder.bind(p;
User input may be syntactically or semantically invalid.
[classname]#Binder# allows adding a chain of one or more __validators__ for
automatically checking the validity of the input before storing it to the data
-object. You can add validators to fields by calling the [methodname]#addValidator#
-method on the [interfacename]#Binding# object returned by [methodname]#Binder.addField#.
+object. You can add validators to fields by calling the [methodname]#withValidator#
+method on the [interfacename]#Binding# object returned by [methodname]#Binder.forField#.
[source, java]
----
-binder.addField(nameField)
- .addValidator(new StringLengthValidator(2, 20,
+binder.forField(nameField)
+ .withValidator(new StringLengthValidator(2, 20,
"Name must be between 2 and 20 characters long"))
.bind(Person::getName, Person::setName);
----
@@ -196,13 +196,13 @@ Because [methodname]#Result.ok# takes the valid value as an argument, a validato
can also do some sanitization on valid inputs, such as removing leading and
trailing whitespace from a string. Since [interfacename]#Validator# is a functional
interface, you can often simply write a lambda expression instead of a full class
-declaration. There is also an [methodname]#addValidator# overload that creates a
+declaration. There is also an [methodname]#withValidator# overload that creates a
validator from a boolean function and an error message.
[source, java]
----
-binder.addField(nameField)
- .addValidator(name -> name.length() < 20,
+binder.forField(nameField)
+ .withValidator(name -> name.length() < 20,
"Name must be less than 20 characters long")
.bind(Person::getName, Person::setName);
diff --git a/documentation/components/components-grid.asciidoc b/documentation/components/components-grid.asciidoc
index b56b762e46..a06989501a 100644
--- a/documentation/components/components-grid.asciidoc
+++ b/documentation/components/components-grid.asciidoc
@@ -912,7 +912,7 @@ BeanBinder<Person> binder = new BeanBinder<>(Person.class);
// Have some extra validation in a field
binder.addField(nameEditor, "name")
- .addValidator(new RegexpValidator(
+ .withValidator(new RegexpValidator(
"^\\p{Alpha}+ \\p{Alpha}+$",
"Need first and last name"));