Form Values & Field Highlighting
Collaboration Kit includes a manager to set property values and field highlighting in a form, and to react to their changes. It provides a simple way to create a custom form component with collaborative features.
The manager can also be used in conjunction with a CollaborationBinder (see Collaborative Form Editing) connected to the same topic. Any changes made to property values, or highlighting via the FormManager, are reflected in any fields bound to the same properties — and vice versa.
Source code
FormManagerExample.java
-
Creating a
FormManagertakes a component to bind the manager connection context to the UI, an instance ofUserInfothat represents the current local user, and the topic identifier on which to connect. -
The
highlight()method is used to mark the local user as editing a property. Any field component bound to the same property via aCollaborationBinderconnected to the same topic is highlighted and shows the name of the user. -
The
setHighlightHandler()method sets a callback to handle a user editing a property. The property name and theUserInfoof the user are provided by the context passed as the argument to the callback. This can be used, for example, to focus a field component. -
The callback returns another callback, a
Registration, that’s called when the same user stops editing a property. -
The
setValue()method is used to set the value of a property. The value is set on all field components bound to the same property via aCollaborationBinderinstance connected to the same topic. -
The
setPropertyChangeHandler()method sets a callback to handle a property value change. The property name and the new value are provided by the event passed as the argument to the callback.
8436311F-F248-4CC4-B72F-79A93C5C03FD