All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.gsi.chart.utils.TimeStringConverter Maven / Gradle / Ivy

/*****************************************************************************
 *                                                                           *
 * BI Common - convert Number <-> String                                     *
 *                                                                           *
 * modified: 2017-03-07 Harald Braeuning                                     *
 *                                                                           *
 ****************************************************************************/

package de.gsi.chart.utils;

import java.util.GregorianCalendar;

import javafx.util.StringConverter;

/**
 *
 * @author braeun
 */
public class TimeStringConverter extends StringConverter {

  private final GregorianCalendar calendar = new GregorianCalendar();

  public TimeStringConverter()
  {
  }



  @Override
  public String toString(Number object)
  {
    calendar.setTimeInMillis(object.longValue());
    return String.format("%tT",calendar);
  }

  @Override
  public Number fromString(String string)
  {
    throw new UnsupportedOperationException("Converting from string not supported yet");
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy