]> source.dussan.org Git - vaadin-framework.git/commitdiff
BoV: Components/Label: Remove references to old databinding
authorJohannes Dahlström <johannesd@vaadin.com>
Tue, 19 Jul 2016 08:39:04 +0000 (11:39 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 22 Jul 2016 12:39:32 +0000 (12:39 +0000)
Change-Id: I329c725b545df065c1bea133438d685cf7fd9791

documentation/components/components-label.asciidoc

index 424e5ae76c2b3c33acda39719b26558436add734..f225c6ba7328f49908653b0c3c8530718ba20bee 100644 (file)
@@ -31,9 +31,8 @@ layout.addComponent(label);
 ----
 See the http://demo.vaadin.com/book-examples-vaadin7/book#component.label.basic[on-line example, window="_blank"].
 
-[classname]#Label# implements the [interfacename]#Property# interface to allow
-accessing the text value, so you can get and set the text with
-[methodname]#getValue()# and [methodname]#setValue()#.
+You can get and set the text of a [classname]#Label# with the
+[methodname]#getValue()# and [methodname]#setValue()# methods.
 
 [source, java]
 ----
@@ -42,18 +41,11 @@ TextField editor = new TextField(null, // No caption
                                  label.getValue());
 
 // Change the label's text
-editor.addValueChangeListener(event -> // Java 8
-    label.setValue(editor.getValue()));
-editor.setImmediate(true); // Send on Enter
+editor.onChange(label::setValue);
+// or onChange(value -> label.setValue(value));
 ----
 See the http://demo.vaadin.com/book-examples-vaadin7/book#component.label.basic[on-line example, window="_blank"].
 
-Label also supports data binding to a property data source, as described later
-in <<components.label.databinding>>. However, in that case the value can not be
-set through the label, as [classname]#Label# is not a
-[interfacename]#Property.Editor# and is not allowed to write to a bound
-property.
-
 Even though [classname]#Label# is text and is often used as a caption, it is a
 normal component and therefore also has a caption that you can set with
 [methodname]#setCaption()#. As with most other components, the caption is
@@ -248,48 +240,6 @@ horizontal.addComponent(button2);
 
 endif::web[]
 
-[[components.label.databinding]]
-== Data Binding
-
-While [classname]#Label# is not a field component, it is a
-[interfacename]#Property.Viewer# and can be bound to a property data source,
-described in
-<<dummy/../../../framework/datamodel/datamodel-properties#datamodel.properties,"Properties">>.
-You can specify the data source either in the constructor or by the
-[methodname]#setPropertyDataSource()# method.
-
-
-[source, java]
-----
-// Some property
-ObjectProperty<String> property =
-    new ObjectProperty<String>("some value");
-
-// Label that is bound to the property
-Label label = new Label(property);
-----
-See the http://demo.vaadin.com/book-examples-vaadin7/book#component.label.binding[on-line example, window="_blank"].
-
-Further, as [classname]#Label# is a [interfacename]#Property#, you can edit its
-value with a property editor, such as a field:
-
-
-[source, java]
-----
-Label label = new Label("some value");
-TextField editor = new TextField();
-editor.setPropertyDataSource(label);
-editor.setImmediate(true);
-----
-See the http://demo.vaadin.com/book-examples-vaadin7/book#component.label.delegation[on-line example, window="_blank"].
-
-However, [classname]#Label# is __not__ a [interfacename]#Property.Editor#, so it
-is read-only when bound to a data source. Therefore, you can not use
-[methodname]#setValue()# to set the value of a connected data source through a
-[classname]#Label# nor bind the label to an editor field, in which case writes
-would be delegated through the label.
-
-
 [[components.label.css]]
 == CSS Style Rules