com.vaadin.ui.renderers.

Class DateRenderer

    • Constructor Detail

      • DateRenderer

        public DateRenderer()

        Creates a new date renderer.

        The renderer is configured to render with the Date.toString() representation for the default locale.

      • DateRenderer

        public DateRenderer​(Locale locale,
                            String nullRepresentation)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with the Date.toString() representation for the given locale.

        Parameters:

        locale - the locale in which to present dates

        nullRepresentation - the textual representation of null value

        Throws:

        IllegalArgumentException - if locale is null

      • DateRenderer

        public DateRenderer​(String formatString)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with the given string format, as displayed in the default locale.

        Parameters:

        formatString - the format string with which to format the date

        Throws:

        IllegalArgumentException - if formatString is null

        See Also:

        Format String Syntax

      • DateRenderer

        public DateRenderer​(String formatString,
                            String nullRepresentation)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with the given string format, as displayed in the default locale.

        Parameters:

        formatString - the format string with which to format the date

        nullRepresentation - the textual representation of null value

        Throws:

        IllegalArgumentException - if formatString is null

        See Also:

        Format String Syntax

      • DateRenderer

        public DateRenderer​(String formatString,
                            Locale locale)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with the given string format, as displayed in the given locale.

        Parameters:

        formatString - the format string to format the date with

        locale - the locale to use

        Throws:

        IllegalArgumentException - if either argument is null

        See Also:

        Format String Syntax

      • DateRenderer

        public DateRenderer​(String formatString,
                            Locale locale,
                            String nullRepresentation)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with the given string format, as displayed in the given locale.

        Parameters:

        formatString - the format string to format the date with

        locale - the locale to use

        nullRepresentation - the textual representation of null value

        Throws:

        IllegalArgumentException - if either argument is null

        See Also:

        Format String Syntax

      • DateRenderer

        public DateRenderer​(DateFormat dateFormat)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with he given date format.

        Parameters:

        dateFormat - the date format to use when rendering dates

        Throws:

        IllegalArgumentException - if dateFormat is null

      • DateRenderer

        public DateRenderer​(DateFormat dateFormat,
                            String nullRepresentation)
                     throws IllegalArgumentException

        Creates a new date renderer.

        The renderer is configured to render with he given date format.

        Parameters:

        dateFormat - the date format to use when rendering dates

        Throws:

        IllegalArgumentException - if dateFormat is null

    • Method Detail

      • encode

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

        Description copied from interface: Renderer

        Encodes the given value into a JsonValue.

        Specified by:

        encode in interface Renderer<Date>

        Overrides:

        encode in class AbstractRenderer<Object,​Date>

        Parameters:

        value - the value to encode

        Returns:

        a JSON representation of the given value

      • getState

        protected DateRendererState 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,​Date>

        Returns:

        The shared state for this connector. Never null.