Class RendererUtil


  • public class RendererUtil
    extends Object
    Contains helper methods to register events triggered by rendered templates.

    Used internally by components that support TemplateRenderer.

    Author:
    Vaadin Ltd
    • Method Detail

      • registerEventHandlers

        public static <T> void registerEventHandlers​(Renderer<T> renderer,
                                                     Element contentTemplate,
                                                     Element templateDataHost,
                                                     ValueProvider<String,​T> keyMapper)
        Registers the event handlers associated to a TemplateRenderer, if any. The consumers returned by Renderer.getEventHandlers() are processed and properly configured to trigger messages from the client to the server, so event handlers can catch the events and execute custom logic.
        Type Parameters:
        T - the type of the renderer and the associated keyMapper
        Parameters:
        renderer - the TemplateRenderer to be evaluated
        contentTemplate - the <template> element that contains the children that fire events
        templateDataHost - the data host of the events - typically the parent of the contentTemplate, but not necessarily
        keyMapper - a value provider that knows how to return items by a given key