Releases: vaadin/collaboration-kit
Collaboration Engine 3.2.1
Fix ordering between activation and deactivation
Use dispatch action for both so that they are carried out in the same order that they were triggered. Previously if the component was attached and detached during the same round trip, then deactivation happens before activation, which caused deactivation to be a no-op since the registrations to clear on deactivation haven't yet been created.
Collaboration Engine 3.2.0
What's new in 3.2
Two new APIs are the biggest changes since 3.1; the PresenceManager
to handle user presence in topics, and the MessageConfigurator
to customize messages in the CollaborationMessageList component.
PresenceManager
API to handle user presence in topics
The new PresenceManager
can now be used as a middle-layer API to handle user presence in topics: set the local-user presence, handle user presence changes and get the present users in a topic. This new API makes it easy to create custom components with collaboration features, for example a list of active users in a topic:
PresenceManager presence = new PresenceManager(users, ownUserInfo, topicId);
presence.markAsPresent(true);
// Create your own list to keep track of the users in the topic
List<UserInfo> userList = ...;
// ...
presenceManager.setNewUserHandler(userInfo -> {
// Add the new user to the local list when she joins the topic
userList.add(userInfo);
return () -> {
// Remove the user from the local list when she leaves the topic
userList.remove(userInfo);
};
});
Related issue: #37
Another example of a use-case can be found in our Collab Engine demo that enables seeing who's editing an employee form without opening up the form editing, all in real time. On top of reacting to changes of actual people opening up a form, we created a custom component using the PresenceManager
to display bots' avatars that are also making changes in the forms.
MessageConfigurator
API to customize messages
Enables changing the properties of MessageListItem
after CollaborationMessageList
has generated them.
For example, theme variants can be added and removed to differentiate the current user's own messages from the others .
collaborationMessageList.setMessageConfigurator((message, user) -> {
if (user.equals(localUser)) {
message.addThemeNames("outbound");
}
});
Related issue: #30
Other changes
- Fixed possible memory leak in the ComponentConnectionContext by cleaning up all listeners if closed through the registration (#44)
- Fixed URL authorization issues with Spring Security (#41)
- Push is now automatically enabled (#43)
Compatibility
This version is part of Vaadin 21.
Collaboration Engine 3.2.0.rc1
What's new in 3.2
Two new APIs are the biggest changes since 3.1; the PresenceManager
to handle user presence in topics, and the MessageConfigurator
to customize messages in the CollaborationMessageList component.
PresenceManager
API to handle user presence in topics
The new PresenceManager
can now be used as a middle-layer API to handle user presence in topics: set the local-user presence, handle user presence changes and get the present users in a topic. This new API makes it easy to create custom components with collaboration features, for example a list of active users in a topic:
PresenceManager presence = new PresenceManager(users, ownUserInfo, topicId);
presence.markAsPresent(true);
// Create your own list to keep track of the users in the topic
List<UserInfo> userList = ...;
// ...
presenceManager.setNewUserHandler(userInfo -> {
// Add the new user to the local list when she joins the topic
userList.add(userInfo);
return () -> {
// Remove the user from the local list when she leaves the topic
userList.remove(userInfo);
};
});
Related issue: #37
Another example of a use-case can be found in our Collab Engine demo that enables seeing who's editing an employee form without opening up the form editing, all in real time. On top of reacting to changes of actual people opening up a form, we created a custom component using the PresenceManager
to display bots' avatars that are also making changes in the forms.
MessageConfigurator
API to customize messages
Enables changing the properties of MessageListItem
after CollaborationMessageList
has generated them.
For example, theme variants can be added and removed to differentiate the current user's own messages from the others .
collaborationMessageList.setMessageConfigurator((message, user) -> {
if (user.equals(localUser)) {
message.addThemeNames("outbound");
}
});
Related issue: #30
Other changes
- Fixed possible memory leak in the ComponentConnectionContext by cleaning up all listeners if closed through the registration (#44)
- Fixed URL authorization issues with Spring Security (#41)
- Push is now automatically enabled (#43)
Compatibility
This version is part of Vaadin 21.
Vaadin Collaboration Engine 3.2.0.beta1
The only change compared to the previous alpha release is some dependency version bumps to ensure compatibility with future Vaadin versions.
Vaadin Collaboration Engine 3.2.0.alpha3
Refactored PresenceManager
API
The PresenceManager
, introduced in 3.2.0.alpha2
, has been improved based on feedback.
setAutoPresence
has been renamed tomarkAsPresent
PresenceManager presence = new PresenceManager(users, ownUserInfo, topicId);
presence.markAsPresent(true);
getUsers
method has been removed from the public API. The method always returned0
before the connection was established, which lead to confusion. Developers should now register aNewUserHandler
if they want keep track of the users as they are added or removed from a topic.
Example: Keeping a list of users in a topic.
// Create your own list to keep track of the users in the topic
List<UserInfo> userList = ...;
// ...
presenceManager.setNewUserHandler(userInfo -> {
// Add the new user to the local list when she joins the topic
userList.add(userInfo);
return () -> {
// Remove the user from the local list when she leaves the topic
userList.remove(userInfo);
};
});
Vaadin Collaboration Engine 3.2.0.alpha2
Add PresenceManager
API to handle user presence in topics
The new PresenceManager
can now be used as a middle-layer API to handle user presence in topics: set the local-user presence, handle user presence changes and get the present users in a topic. This new API makes it easy to create custom components with collaboration features, for example a list of active users:
VerticalLayout users = new VerticalLayout();
PresenceManager presence = new PresenceManager(users, ownUserInfo, topicId);
presence.setAutoPresence(true);
presence.setNewUserHandler(newUserInfo -> {
Component card = createUserCard(newUserInfo);
users.add(card);
return () -> users.remove(card);
});
Related issue: #37
Other changes
3.2.0.alpha1
Add MessageConfigurator API to customize messages
Enables changing the properties of MessageListItem
after CollaborationMessageList
has generated them.
For example, theme variants can be added and removed to differentiate the current user's own messages from the others .
collaborationMessageList.setMessageConfigurator((message, user) -> {
if (user.equals(localUser)) {
message.addThemeNames("outbound");
}
});
Related issue: #30
Compatibility
This version is targeted for Vaadin 21, and will be included in the following Vaadin 21 pre-release.
Collaboration Engine 3.1.1
Fixed beacon problems when using Spring Security
Previous URL for the beacon (/beacon/) was being blocked by Spring security's CSRF filtering. That generated an internal redirect to the error page, which could make the error page be saved by the SavedRequestAwareAuthenticationSuccessHandler. This issue was fixed by changing the URL to use to the format used by Flow's internal requests, which should be not be blocked. (#41)
Collaboration Engine 3.1.0
What's new in 3.1
Collaboration Engine 3.1 introduced the Discuss feature, to create a chat with only a few lines of code by automatically synchronizing the messages for all users connected to the same topic. The implementation includes two components: CollaborationMessageList and CollaborationMessageInput.
Example to set it up:
User userEntity = userService.getCurrentUser();
UserInfo userInfo = new UserInfo(userEntity.getId(),
userEntity.getName(), userEntity.getImageUrl());
String topicId = "general";
CollaborationMessageList messageList = new CollaborationMessageList(
userInfo, topicId);
CollaborationMessageInput messageInput = new CollaborationMessageInput(
messageList);
layout.add(messageList, messageInput);
Support for Persistent Messages in Discussion Components
Messages added to a CollaborationMessageList
can be persisted on an external backend to retain them when the application restarts. You can set a CollaborationMessagePersister
on the list and implement your logic to e.g. save messages to a database.
CollaborationMessagePersister persister = CollaborationMessagePersister.fromCallbacks(
fetchQuery -> messageRepository
.findAllByTopicSince(fetchQuery.getTopicId(), fetchQuery.getSince())
.stream().map(entity -> new CollaborationMessage(
new UserInfo(entity.getAuthor().getId()),
entity.getText(),
entity.getTime()
)),
persistRequest -> {
CollaborationMessage message = persistRequest.getMessage();
MessageEntity entity = new MessageEntity(
message.getText(),
persistRequest.getTopicId(),
userRepository.findById(message.getUser().getId());
);
messageRepository.save(entity);
});
CollaborationMessageList list = new CollaborationMessageList(user, topic, persister);
Submitter API for custom input components
CollaborationMessageInput
is the provided component to submit messages to a CollaborationMessageList
. You can connect a custom component to submit to the message list and configure it via a CollaborationMessageSubmitter
which will be activated when the list connects to the topic.
CollaborationMessageList list = new CollaborationMessageList(user, topic);
TextField field = new TextField();
Button button = new Button("Send");
button.setEnabled(false);
list.setSubmitter(activationContext -> {
button.setEnabled(true);
Registration clickRegistration = button.addClickListener(event -> {
activationContext.appendMessage(field.getValue());
field.setValue("");
});
return () -> {
clickRegistration.remove();
button.setEnabled(false);
};
});
layout.add(list, field, button);
Other Noteworthy Changes Since 3.0
- Make Collaboration Engine OSGi compatible
CollaborationList
as a new low-level data type- Expiration timeout for
CollaborationBinder
- Configure Collaboration Engine by defining a subclass of
CollaborationEngineConfiguration
as a Spring or CDI bean. - Fixed field highlight inside
Dialog
. - Providing images as stream resources with
CollaborationMessageList::setImageProvider
. - Trying to use an inactive topic connection now throws an exception. Trying to subscribe to data changes or update the data in Collaboration Engine while the topic connection is not active does not work. Now this is explicitly forbidden by throwing an exception. This affects only the low-level API usage (
CollaborationEngine::openTopicConnection
) userInfo.setColorIndex(-1)
now means that the Collaboration Engine should manage the user's color index and keep it consistent across topics and components. -1 is now the default value for the color index.CollaborationEngine
has now a public method,getUserColorIndex(UserInfo userInfo)
. It returns the user's color index that is explicitly defined. When the color index is -1, it will assign a color index automatically. It is useful when you build custom collaborative experiences and want to user colors which are consistent with other features, likeCollaborationBinder
andCollaborationAvatarGroup
.
- Removed the Vaadin BOM, now the Flow dependencies are scoped as provided.
UserInfo
can now be created outside the UI thread.
Compatibility
This version is part of Vaadin 20, and will also be compatible with the upcoming Vaadin 14.7 release.
3.1.0.beta2
Fix Persister Skipping Messages Sent at the Same Timestamp
The user should implement CollaborationMessagePersister
to fetch messages which have been submitted from the timestamp provided by FetchQuery::getSince
. This is the timestamp of the last message that is already loaded. Previously it was expected that the persister implementation returns messages after this timestamp (message.getTime() > fetchQuery.getSince()
). This meant that if there are multiple messages submitted during the same millisecond, not all messages would be loaded. To fix this, now it's expected to include the messages at the getSince
timestamp (message.getTime() >= fetchQuery.getSince()
). The component will take care of filtering duplicates, which are expected when returning again the already loaded latest messages.
Compatibility
This version is targeted for Vaadin 20, and will be included in the following Vaadin 20 pre-release.