Class EditorRenderer<T>

    • Constructor Detail

      • EditorRenderer

        public EditorRenderer​(Editor<T> editor,
                              String columnInternalId)
        Creates a new renderer for a specific column.
        Parameters:
        editor - the Grid's editor
        columnInternalId - the internal Id of the column that uses this data generator
    • Method Detail

      • setComponentFunction

        public void setComponentFunction​(SerializableFunction<T,​? extends Component> componentFunction)
        Sets the function that creates components to be used as editors for the column. When set to null, an empty component is used instead.
        Parameters:
        componentFunction - the function that generates editor components
      • generateData

        public void generateData​(T item,
                                 elemental.json.JsonObject jsonObject)
        Description copied from interface: DataGenerator
        Adds custom data for the given item to its serialized JsonObject representation. This JSON object will be sent to client-side DataProvider.
        Specified by:
        generateData in interface DataGenerator<T>
        Parameters:
        item - the data item being serialized
        jsonObject - the JSON object being sent to the client
      • refreshData

        public void refreshData​(T item)
        Description copied from interface: DataGenerator
        Informs the DataGenerator that a data object has been updated. This method should update any unneeded information stored for given item.
        Specified by:
        refreshData in interface DataGenerator<T>
        Parameters:
        item - the updated item
      • render

        public Rendering<T> render​(Element container,
                                   DataKeyMapper<T> keyMapper,
                                   Element contentTemplate)
        Description copied from class: Renderer
        Handles the rendering of the model objects by using the given <template> element in the given container.

        Subclasses of Renderer usually override this method to provide additional features.

        Overrides:
        render in class Renderer<T>
        Parameters:
        container - the element in which the template will be attached to, not null
        keyMapper - mapper used internally to fetch items by key and to provide keys for given items. It is required when either event handlers or DataGenerator are supported
        contentTemplate - the <template> element to be used for rendering in the container, not null
        Returns:
        the context of the rendering, that can be used by the components to provide extra customization