summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'documentation')
-rw-r--r--documentation/datamodel/datamodel-forms.asciidoc12
1 files changed, 12 insertions, 0 deletions
diff --git a/documentation/datamodel/datamodel-forms.asciidoc b/documentation/datamodel/datamodel-forms.asciidoc
index f307144a57..5be66f81ea 100644
--- a/documentation/datamodel/datamodel-forms.asciidoc
+++ b/documentation/datamodel/datamodel-forms.asciidoc
@@ -91,6 +91,18 @@ binder.bind(nameField,
}
});
----
+== Binding non-modifiable Data
+
+Non-modifiable data can be also bound to any component or component property with [classname]#ReadOnlyHasValue# helper class.
+For example, `Panel` caption can display a person full name:
+
+[source, java]
+----
+Panel infoPanel = new Panel();
+ReadOnlyHasValue<Person> panelTitle = new ReadOnlyHasValue<>(
+ person -> infoPanel.setCaption(person.getLastName() + ", " + person.getFirstName()));
+binder.forField(panelTitle).bind(person -> person, null);
+----
== Validating and Converting User Input