Class ListGridDateTimeFormatter

java.lang.Object
com.jbstrap.ui.components.listgrid.formatters.ListGridDateTimeFormatter
All Implemented Interfaces:
ListGridCellFormatter, ListGridCellFormatterCustomFormat

public class ListGridDateTimeFormatter extends Object implements ListGridCellFormatterCustomFormat

Date and time formatter class for the ListGrid.

The class formats a time value to a value comprehensible to the user. The class formats the received value to the framework’s default time format. The default time format can be set using the JBStrapParamType.DATETIME_FORMAT parameter. Additionally, custom time formats can also be specified. If specified, the custom time format is used to convert the value.

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • ListGridDateTimeFormatter

      public ListGridDateTimeFormatter()
  • Method Details

    • setFormat

      public ListGridDateTimeFormatter setFormat(String format)
      Sets the date and time format for value conversion.
      Specified by:
      setFormat in interface ListGridCellFormatterCustomFormat
      Parameters:
      format - The format to be used If null is specified, the formatter uses the framework’s default time format. The framework’s default date and time format can be set using the JBStrap parameter JBStrapParamType.DATETIME_FORMAT.
      Returns:
      Date formatter class
    • format

      public String format(Object data)
      Formats the received value.
      Specified by:
      format in interface ListGridCellFormatter
      Parameters:
      data - The value to be formatted
      Returns:
      If the received value is a Date value, the date value in text format or in other cases an empty string is returned using the defined date format.