Package com.vaadin.collaborationengine
Class FormManager
java.lang.Object
com.vaadin.collaborationengine.AbstractCollaborationManager
com.vaadin.collaborationengine.FormManager
- All Implemented Interfaces:
HasExpirationTimeout,Serializable
Manager to handle form values and field highlight state. It allows to set a
value for a property and toggle the highlight of a property for a user.
Handlers can be set to react when a value changes or when the highlight
status changes.
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.collaborationengine.AbstractCollaborationManager
AbstractCollaborationManager.ActivationHandler -
Constructor Summary
ConstructorsConstructorDescriptionFormManager(ConnectionContext context, UserInfo localUser, String topicId, SerializableSupplier<CollaborationEngine> ceSupplier) Creates a new manager for the provided connection context.FormManager(Component component, UserInfo localUser, String topicId) Creates a new manager for the provided component. -
Method Summary
Modifier and TypeMethodDescriptionGets the optional expiration timeout of the field property data.voidSets the highlight state of the provided property name for the local user.voidSets the highlight state at the provided field index of the provided property name for the local user.voidsetExpirationTimeout(Duration expirationTimeout) Sets the expiration timeout of the field property data.voidsetHighlightHandler(HighlightHandler handler) Sets a handler which will be invoked when a highlight is set.voidSets a handler which will be invoked when a property changes value.voidSets the value for the provided property name.Methods inherited from class com.vaadin.collaborationengine.AbstractCollaborationManager
close, getCollaborationEngine, getLocalUser, getTopicId, onConnectionFailed, openTopicConnection, setActivationHandler
-
Constructor Details
-
FormManager
public FormManager(ConnectionContext context, UserInfo localUser, String topicId, SerializableSupplier<CollaborationEngine> ceSupplier) Creates a new manager for the provided connection context.The provided user information is used to set the highlight for the local user with
highlight(String,boolean)orhighlight(String,boolean,int)(the default isfalse).- Parameters:
context- the context that manages connection status, notnulllocalUser- the information of the local user, notnulltopicId- the id of the topic to connect to, notnullceSupplier- the collaboration engine instance to use, notnull
-
FormManager
Creates a new manager for the provided component.The provided user information is used to set the highlight for the local user with
highlight(String,boolean)orhighlight(String,boolean,int)(the default isfalse).- Parameters:
component- the component which holds UI access, notnulllocalUser- the information of the local user, notnulltopicId- the id of the topic to connect to, notnull
-
-
Method Details
-
setValue
Sets the value for the provided property name.- Parameters:
propertyName- the name of the property that is being set, notnullvalue- the value to set
-
highlight
Sets the highlight state of the provided property name for the local user. For properties that require a field index, this defaults to 0.- Parameters:
propertyName- the name of the property to highlight or remove highlight, notnullhighlight- the highlight state to set
-
highlight
Sets the highlight state at the provided field index of the provided property name for the local user.- Parameters:
propertyName- the name of the property to highlight or unhighlight, notnullhighlight- the highlight state to setfieldIndex- the field index to highlight or unhighlight
-
setPropertyChangeHandler
Sets a handler which will be invoked when a property changes value.The handler accepts a
PropertyChangeHandler.PropertyChangeEventinstance as a parameter.- Parameters:
handler- the property change handler, ornullto remove an existing handler
-
setHighlightHandler
Sets a handler which will be invoked when a highlight is set.The handler accepts a
HighlightHandler.HighlightContextinstance as a parameter and should return aRegistrationwhich will be removed when the highlight is toggled off.Replacing an existing handler will remove all registrations from the previous one.
- Parameters:
handler- the highlight handler, ornullto remove an existing handler
-
setExpirationTimeout
Sets the expiration timeout of the field property data. If set, data is cleared whenexpirationTimeouthas passed after the last connection to the related topic is closed. If set tonull, the timeout is cancelled.- Specified by:
setExpirationTimeoutin interfaceHasExpirationTimeout- Parameters:
expirationTimeout- the expiration timeout
-
getExpirationTimeout
Gets the optional expiration timeout of the field property data. An emptyOptionalis returned if no timeout it set, which means data is not cleared when there are no connected users to the related topic.- Specified by:
getExpirationTimeoutin interfaceHasExpirationTimeout- Returns:
- the expiration timeout
-