Class ListGridDateFormatter

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

public class ListGridDateFormatter extends Object implements ListGridCellFormatterCustomFormat

Date formatter class for the ListGrid.

The class formats a date 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 date formats can also be specified. If specified, the custom date format is used to convert the value.

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • ListGridDateFormatter

      public ListGridDateFormatter()
  • Method Details

    • setFormat

      public ListGridDateFormatter setFormat(String format)
      Sets the date 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 date format. The framework’s default date and time format can be set using the JBStrap parameter JBStrapParamType.DATE_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.