Class DateGraphFormat

java.lang.Object
java.text.Format
java.text.NumberFormat
xal.extension.widgets.plot.DateGraphFormat
All Implemented Interfaces:
Serializable, Cloneable

public class DateGraphFormat extends NumberFormat
DateGraphFormat is the subclass of the NumberFormat class. It produces the x-axis markers as a date by using an internal date format. X-axis values are supposed to be the number of seconds since January 1, 1970, 00:00:00 GMT. To use this format for the x-axis call the method setNumberFormatX(NumberFormat df) of the instance of FunctionGraphsJPanel class with the DateGraphFormat instance instead of NumberFormat.
Author:
shishlo
See Also:
  • Constructor Details

    • DateGraphFormat

      public DateGraphFormat()
      Constructor with a default DateFormat (it is SimpleDateFormat("HH:mm:ss")).
    • DateGraphFormat

      public DateGraphFormat(String pattern)
      Constructor with a date format pattern as the parameter.
    • DateGraphFormat

      public DateGraphFormat(DateFormat dateFormatIn)
      Constructor with a DateFormat as a parameter.
  • Method Details

    • parse

      public Number parse(String input, ParsePosition position)
      Don't call. Just returns null. Satisfied abstract method requirement.
      Specified by:
      parse in class NumberFormat
    • format

      public StringBuffer format(double tSec, StringBuffer toAppendTo, FieldPosition pos)
      The overridden format method of the NumberFormat class.
      Specified by:
      format in class NumberFormat
    • format

      public StringBuffer format(long tSec, StringBuffer toAppendTo, FieldPosition pos)
      The overridden format method of the NumberFormat class.
      Specified by:
      format in class NumberFormat
    • getDateFormat

      public DateFormat getDateFormat()
      Returns the instance of the DateFormat class that is used to format the seconds to the date.
    • setDateFormat

      public void setDateFormat(DateFormat dateFormat)
      Sets the instance of the DateFormat class that will be used to format the seconds to the date.
    • getSeconds

      public static double getSeconds(Date date)
      Transforms the date to the seconds since January 1, 1970, 00:00:00 GMT.
      Returns:
      double as a number of seconds
    • getDate

      public static Date getDate(double seconds)
      Transforms the seconds since January 1, 1970, 00:00:00 GMT to the date.
      Returns:
      an instance of the Date class.