Class PresenceManager
- All Implemented Interfaces:
Serializable
- Since:
- 3.2
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.collaborationengine.AbstractCollaborationManager
AbstractCollaborationManager.ActivationHandler
-
Constructor Summary
ConstructorDescriptionPresenceManager
(ConnectionContext context, UserInfo localUser, String topicId, CollaborationEngine collaborationEngine) Deprecated, for removal: This API element is subject to removal in a future version.This constructor is not compatible with serializationPresenceManager
(ConnectionContext context, UserInfo localUser, String topicId, SerializableSupplier<CollaborationEngine> ceSupplier) Creates a new manager for the provided connection context.PresenceManager
(Component component, UserInfo localUser, String topicId) Creates a new manager for the provided component. -
Method Summary
Modifier and TypeMethodDescriptionvoid
markAsPresent
(boolean markAsPresent) Configures the manager to mark the local user present in the topic.void
setPresenceHandler
(PresenceHandler handler) Sets a handler which will be invoked when a user becomes present.Methods inherited from class com.vaadin.collaborationengine.AbstractCollaborationManager
close, getCollaborationEngine, getLocalUser, getTopicId, onConnectionFailed, openTopicConnection, setActivationHandler
-
Constructor Details
-
PresenceManager
Creates a new manager for the provided component.The provided user information is used to set the presence of the local user with
markAsPresent(boolean)
(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
-
PresenceManager
@Deprecated(since="6.1", forRemoval=true) public PresenceManager(ConnectionContext context, UserInfo localUser, String topicId, CollaborationEngine collaborationEngine) Deprecated, for removal: This API element is subject to removal in a future version.This constructor is not compatible with serializationCreates a new manager for the provided connection context.The provided user information is used to set the presence of the local user with
markAsPresent(boolean)
(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
-
PresenceManager
public PresenceManager(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 presence of the local user with
markAsPresent(boolean)
(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
ceSupplier
- the collaboration engine instance to use, notnull
-
-
Method Details
-
markAsPresent
public void markAsPresent(boolean markAsPresent) Configures the manager to mark the local user present in the topic.If the user wasn't already present in the topic, all managers connected to the same topic will be notified of the change and their handlers will be applied to the user instance.
- Parameters:
markAsPresent
-true
to mark the user as present in the topic,false
to set as not present
-
setPresenceHandler
Sets a handler which will be invoked when a user becomes present.The handler accepts a
PresenceHandler.PresenceContext
instance as a parameter and should return aRegistration
which will be removed when the user stops being present.Replacing an existing handler will remove all registrations from the previous one.
- Parameters:
handler
- the user presence handler, ornull
to remove an existing handler
-