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​(java.util.Locale locale)
                     throws java.lang.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
        Throws:
        java.lang.IllegalArgumentException - if locale is null
      • DateRenderer

        public DateRenderer​(java.util.Locale locale,
                            java.lang.String nullRepresentation)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if locale is null
      • DateRenderer

        public DateRenderer​(java.lang.String formatString)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if formatString is null
        See Also:
        Format String Syntax
      • DateRenderer

        public DateRenderer​(java.lang.String formatString,
                            java.lang.String nullRepresentation)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if formatString is null
        See Also:
        Format String Syntax
      • DateRenderer

        public DateRenderer​(java.lang.String formatString,
                            java.util.Locale locale)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if either argument is null
        See Also:
        Format String Syntax
      • DateRenderer

        public DateRenderer​(java.lang.String formatString,
                            java.util.Locale locale,
                            java.lang.String nullRepresentation)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if either argument is null
        See Also:
        Format String Syntax
      • DateRenderer

        public DateRenderer​(java.text.DateFormat dateFormat)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if dateFormat is null
      • DateRenderer

        public DateRenderer​(java.text.DateFormat dateFormat,
                            java.lang.String nullRepresentation)
                     throws java.lang.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:
        java.lang.IllegalArgumentException - if dateFormat is null
    • Method Detail

      • getNullRepresentation

        public java.lang.String getNullRepresentation()
        Description copied from class: AbstractRenderer
        Null representation for the renderer.
        Overrides:
        getNullRepresentation in class AbstractRenderer<java.lang.Object,​java.util.Date>
        Returns:
        a textual representation of null
      • encode

        public elemental.json.JsonValue encode​(java.util.Date value)
        Description copied from interface: Renderer
        Encodes the given value into a JsonValue.
        Specified by:
        encode in interface Renderer<java.util.Date>
        Overrides:
        encode in class AbstractRenderer<java.lang.Object,​java.util.Date>
        Parameters:
        value - the value to encode
        Returns:
        a JSON representation of the given value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getState

        protected com.vaadin.shared.ui.grid.renderers.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<java.lang.Object,​java.util.Date>
        Returns:
        The shared state for this connector. Never null.
      • getState

        protected com.vaadin.shared.ui.grid.renderers.DateRendererState getState​(boolean markAsDirty)
        Description copied from class: AbstractClientConnector
        Returns the shared state for this connector.
        Overrides:
        getState in class AbstractRenderer<java.lang.Object,​java.util.Date>
        Parameters:
        markAsDirty - true if the connector should automatically be marked dirty, false otherwise
        Returns:
        The shared state for this connector. Never null.
        See Also:
        AbstractClientConnector.getState()