Package com.vaadin.ui

Class Grid.AbstractRenderer<T>

    • Constructor Detail

      • AbstractRenderer

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

        protected AbstractRenderer​(Class<T> presentationType)
    • Method Detail

      • getSupportedParentType

        @Deprecated
        protected Class<Grid> 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
      • getPresentationType

        public Class<T> 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 JsonValue encode​(T 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> 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
      • encodeValue

        public static <T> JsonValue encodeValue​(Object modelValue,
                                                Renderer<T> renderer,
                                                Converter<?,​?> converter,
                                                Locale locale)
        Converts and encodes the given data model property value using the given converter and renderer. This method is public only for testing purposes.
        Parameters:
        renderer - the renderer to use
        converter - the converter to use
        modelValue - the value to convert and encode
        locale - the locale to use in conversion
        Returns:
        an encoded value ready to be sent to the client
        Since:
        7.6