com.vaadin.ui.renderers.

Class ComponentRenderer

  • All Implemented Interfaces:

    MethodEventSource, ClientConnector, Extension, Connector, Renderer<Component>, Serializable

    public class ComponentRenderer
    extends AbstractRenderer<Object,​Component>

    A renderer for presenting Components.

    Note: The use of ComponentRenderer causes the Grid to generate components for all items currently available in the client-side. This means that a number of components is always generated and sent to the client. Using complex structures of many nested components might be heavy to generate and store, which will lead to performance problems.

    Note: Components will occasionally be generated again during runtime e.g. when selection changes. If your component has an internal state that is not stored into the object, you should reuse the same component instances.

    Example of how to add a Label component to Grid:

     Grid<Person> grid;
     grid.addColumn(person -> new Label(person.getFullName()),
             new ComponentRenderer()).setCaption("Full Name");
     

    Since:

    8.1

    Author:

    Vaadin Ltd

    See Also:

    Serialized Form

    • Constructor Detail

      • ComponentRenderer

        public ComponentRenderer()

        Constructor for ComponentRenderer.

    • Method Detail

      • getState

        protected ComponentRendererState getState()

        Description copied from class: AbstractClientConnector

        Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.

        As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use getState(false) to avoid marking the connector as dirty.

        Overrides:

        getState in class AbstractRenderer<Object,​Component>

        Returns:

        The shared state for this connector. Never null.