com.vaadin.ui.renderers.

Class AbstractRenderer<T,​V>

    • Constructor Detail

      • AbstractRenderer

        protected AbstractRenderer​(Class<V> presentationType,
                                   String nullRepresentation)

        Creates a new renderer with the given presentation type and null representation.

        Parameters:

        presentationType - the data type that this renderer displays, not null

        nullRepresentation - a string that will be sent to the client instead of a regular value in case the actual cell value is null. May be null.

      • AbstractRenderer

        protected AbstractRenderer​(Class<V> presentationType)

        Creates a new renderer with the given presentation type. No null representation will be used.

        Parameters:

        presentationType - the data type that this renderer displays, not null

    • Method Detail

      • getSupportedParentType

        @Deprecated
        protected Class<Grid.Column> getSupportedParentType()
        Deprecated.

        This method is inherited from AbstractExtension but should never be called directly with an AbstractRenderer.

        Overrides:

        getSupportedParentType in class AbstractExtension

        Returns:

        a type that the parent must be an instance of

      • extend

        @Deprecated
        protected void extend​(AbstractClientConnector target)
        Deprecated.

        This method is inherited from AbstractExtension but should never be called directly with an AbstractRenderer.

        Overrides:

        extend in class AbstractExtension

        Parameters:

        target - the connector to attach this extension to

      • getPresentationType

        public Class<V> getPresentationType()

        Description copied from interface: Renderer

        Returns the class literal corresponding to the presentation type T.

        Specified by:

        getPresentationType in interface Renderer<T>

        Returns:

        the class literal of T

      • encode

        public elemental.json.JsonValue encode​(V value)

        Description copied from interface: Renderer

        Encodes the given value into a JsonValue.

        Specified by:

        encode in interface Renderer<T>

        Parameters:

        value - the value to encode

        Returns:

        a JSON representation of the given value

      • getNullRepresentation

        protected String getNullRepresentation()

        Null representation for the renderer.

        Returns:

        a textual representation of null

      • encode

        protected <U> elemental.json.JsonValue encode​(U value,
                                                      Class<U> type)

        Encodes the given value to JSON.

        This is a helper method that can be invoked by an encode(T) override if serializing a value of type other than the presentation type is desired. For instance, a Renderer<Date> could first turn a date value into a formatted string and return encode(dateString, String.class).

        Parameters:

        value - the value to be encoded

        type - the type of the value

        Returns:

        a JSON representation of the given value

      • getParentGrid

        protected Grid<T> getParentGrid()

        Gets the Grid this renderer is attached to. Used internally for indicating the source grid of possible events emitted by this renderer, such as ClickableRenderer.RendererClickEvents.

        Returns:

        the grid this renderer is attached to or null if unattached

      • getState

        protected AbstractRendererState 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 AbstractClientConnector

        Returns:

        The shared state for this connector. Never null.