Helper for updating a UI based on events from a subscription

To properly update something in a Vaadin UI from asynchronous handlers from some kind of subscription, you need to take care of locking the UI, reacting to exception if the UI is detached and make sure you unsubscribe when the UI or view is detached. All this easily adds up to quite many rows of boilerplate.

Accessor is a helper that takes care of all those details for you as long as you provide a callback for updating the UI, a callback for actually subscribing to the updates and a component to bind the life cycle to.

Basic usage follows this form:

Accessor.ofConsumer(this::addMessage)
        .withSubscriber(DemoSubscription::subscribe)
        .bind(this);

Install

Link to this version
BetaReleased 28 November 2018Apache License 2.0
Framework Support
Vaadin platform 10+
Also supported:
Vaadin 8 (8.0.0.beta1)
Browser Independent
Install with
Release notes - Version 0.9.0.1

Repackaged to also include sources and javadocs