Package com.vaadin.collaborationengine
Class FormManager
java.lang.Object
com.vaadin.collaborationengine.AbstractCollaborationManager
com.vaadin.collaborationengine.FormManager
- All Implemented Interfaces:
HasExpirationTimeout
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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.collaborationengine.AbstractCollaborationManager
AbstractCollaborationManager.ActivationHandler
-
Constructor Summary
ConstructorDescriptionFormManager
(ConnectionContext context, UserInfo localUser, String topicId, CollaborationEngine collaborationEngine) 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.void
Sets the highlight state of the provided property name for the local user.void
Sets the highlight state at the provided field index of the provided property name for the local user.void
setExpirationTimeout
(Duration expirationTimeout) Sets the expiration timeout of the field property data.void
setHighlightHandler
(HighlightHandler handler) Sets a handler which will be invoked when a highlight is set.void
Sets a handler which will be invoked when a property changes value.void
Sets 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, CollaborationEngine collaborationEngine) 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, notnull
localUser
- the information of the local user, notnull
topicId
- the id of the topic to connect to, notnull
collaborationEngine
- 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, notnull
localUser
- the information of the local user, notnull
topicId
- 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, notnull
value
- 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, notnull
highlight
- 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, notnull
highlight
- 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.PropertyChangeEvent
instance as a parameter.- Parameters:
handler
- the property change handler, ornull
to remove an existing handler
-
setHighlightHandler
Sets a handler which will be invoked when a highlight is set.The handler accepts a
HighlightHandler.HighlightContext
instance as a parameter and should return aRegistration
which 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, ornull
to remove an existing handler
-
setExpirationTimeout
Sets the expiration timeout of the field property data. If set, data is cleared whenexpirationTimeout
has passed after the last connection to the related topic is closed. If set tonull
, the timeout is cancelled.- Specified by:
setExpirationTimeout
in interfaceHasExpirationTimeout
- Parameters:
expirationTimeout
- the expiration timeout
-
getExpirationTimeout
Gets the optional expiration timeout of the field property data. An emptyOptional
is returned if no timeout it set, which means data is not cleared when there are no connected users to the related topic.- Specified by:
getExpirationTimeout
in interfaceHasExpirationTimeout
- Returns:
- the expiration timeout
-