Class NumberRenderer

    • Constructor Detail

      • NumberRenderer

        public NumberRenderer()
        Creates a new number renderer.

        The renderer is configured to render with the number's natural string representation in the default locale.

      • NumberRenderer

        public NumberRenderer​(java.text.NumberFormat numberFormat)
        Creates a new number renderer.

        The renderer is configured to render the number as defined with the given number format.

        Parameters:
        numberFormat - the number format with which to display numbers
        Throws:
        java.lang.IllegalArgumentException - if numberFormat is null
      • NumberRenderer

        public NumberRenderer​(java.text.NumberFormat numberFormat,
                              java.lang.String nullRepresentation)
                       throws java.lang.IllegalArgumentException
        Creates a new number renderer.

        The renderer is configured to render the number as defined with the given number format.

        Parameters:
        numberFormat - the number format with which to display numbers
        nullRepresentation - the textual representation of null value
        Throws:
        java.lang.IllegalArgumentException - if numberFormat is null
      • NumberRenderer

        public NumberRenderer​(java.util.Locale locale)
                       throws java.lang.IllegalArgumentException
        Creates a new number renderer.

        The renderer is configured to render with the number's natural string representation in the given locale.

        Parameters:
        locale - the locale in which to display numbers
        Throws:
        java.lang.IllegalArgumentException - if locale is null
      • NumberRenderer

        public NumberRenderer​(java.lang.String formatString,
                              java.util.Locale locale)
                       throws java.lang.IllegalArgumentException
        Creates a new number renderer.

        The renderer is configured to render with the number's natural string representation in the given locale.

        Parameters:
        formatString - the format string with which to format the number
        locale - the locale in which to display numbers
        Throws:
        java.lang.IllegalArgumentException - if locale is null
      • NumberRenderer

        public NumberRenderer​(java.lang.String formatString)
                       throws java.lang.IllegalArgumentException
        Creates a new number renderer.

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

        Parameters:
        formatString - the format string with which to format the number
        Throws:
        java.lang.IllegalArgumentException - if formatString is null
        See Also:
        Format String Syntax
      • NumberRenderer

        public NumberRenderer​(java.lang.String formatString,
                              java.util.Locale locale,
                              java.lang.String nullRepresentation)
        Creates a new number renderer.

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

        Parameters:
        formatString - the format string with which to format the number
        locale - the locale in which to present numbers
        Throws:
        java.lang.IllegalArgumentException - if either argument is null
        See Also:
        Format String Syntax
    • Method Detail

      • encode

        public elemental.json.JsonValue encode​(java.lang.Number value)
        Description copied from interface: Renderer
        Encodes the given value into a JsonValue.
        Specified by:
        encode in interface Renderer<java.lang.Number>
        Overrides:
        encode in class AbstractRenderer<java.lang.Object,​java.lang.Number>
        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
      • 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.lang.Number>
        Returns:
        a textual representation of null
      • getState

        protected com.vaadin.shared.ui.grid.renderers.NumberRendererState 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.lang.Number>
        Returns:
        The shared state for this connector. Never null.
      • getState

        protected com.vaadin.shared.ui.grid.renderers.NumberRendererState getState​(boolean markAsDirty)
        Description copied from class: AbstractClientConnector
        Returns the shared state for this connector.
        Overrides:
        getState in class AbstractRenderer<java.lang.Object,​java.lang.Number>
        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()