Class DataCell

    • Method Detail

      • getValue

        public Object getValue()
      • setValue

        public void setValue​(Object value)
      • getFormat

        public Format getFormat()
      • setFormat

        public void setFormat​(Format format)
        Format used for calculating the value to a String used for rendering of f in JavaScript.
        Parameters:
        format - The format to applied if the formatted value of the instance is null. For Number this can be a DecimalFormat, for Dates for instance a SimpleDateFormat.
      • getFormatted

        public String getFormatted()
        Return the formatted value. If this is null, null is also returned and there should be no rendering of f in JavaScript. In this case format conversion is done by Google chart lib. See therefor Chart.getLocale(). If getFormat() is not null and the formatted field is null, the format is applied to the value. If formatted field is not null this is returned without change, so a single DataCell can override the Formatter.
        Returns:
        Field formatted if field format is null. If field format is not null and field formatted is null, the format is applied to the value and the result is returned.
      • setFormatted

        public void setFormatted​(String formatted)
      • toJSON

        public com.github.openjson.JSONObject toJSON()
        Description copied from interface: Jsonable
        Create the JSON serialization of the instance.
        Specified by:
        toJSON in interface Jsonable
        Returns:
        Json object for the instance.
      • getJsValue

        public static Object getJsValue​(Object val)
        Create a representation of a Java object suitable for a put operation to a JSONObject. For simple types like String and Number the object is returned unmodified.

        Booleans are rendered as String "true" or "false"

        Dates or Calendars are rendered as JsonFunction "Date()" by use of createJsDate(java.util.Calendar).

        TimeOfDay are rendered as JSONArray by use of TimeOfDay.getTimeOfDayArray().

        Parameters:
        val - The object to convert to.
        Returns:
        JSON compatible wrapping of the value or the value itself for simple types.
      • createExplicitJsDate

        public static JSONFunction createExplicitJsDate​(Calendar cal)
        Convert a Calendar object to a JavaScript Date() call that generates the same value. Return as a human readable JsonFunction (new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]])) for rendering in JSONObjects.
        Parameters:
        cal - Calender value to render.
        Returns:
        JavaScript Date function for the value.
      • createJsDate

        public static JSONFunction createJsDate​(Calendar cal)
        Convert a Calendar object to a JavaScript Date() call that generates the same value. Return as a JsonFunction(new Date(value);) (milliseconds since epoch) for rendering in JSONObjects .
        Parameters:
        cal - Calender value to render.
        Returns:
        JavaScript Date function for the value.
      • createJsDate

        public static JSONFunction createJsDate​(Date date)
        Convert a Date object to a JavaScript Date() call that generates the same value. Return as a JsonFunction(new Date(value);)(milliseconds since epoch) for rendering in JSONObjects.
        Parameters:
        date - Date value to render.
        Returns:
        JavaScript Date function for the value.