Class ListGridBooleanFormatter

java.lang.Object
com.jbstrap.ui.components.listgrid.formatters.ListGridBooleanFormatter
All Implemented Interfaces:
ListGridCellFormatter

public class ListGridBooleanFormatter extends Object implements ListGridCellFormatter

Boolean formatter class for the ListGrid component

The class formats a boolean value to a value comprehensible to the user. If the class formats a Boolean value that is true, the value is “Yes”. Otherwise, the value is “No”. The class enables you to set custom return values for TRUE and FALSE values. A custom text can be specified for each value.

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • ListGridBooleanFormatter

      public ListGridBooleanFormatter()
      Creates the formatter class using the default settings. A TRUE value is converted to “Yes” and a FALSE value to “No”.
    • ListGridBooleanFormatter

      public ListGridBooleanFormatter(String trueValue, String falseValue)
      Creates the formatter class and sets TRUE and FALSE values according to the specified custom values.
      Parameters:
      trueValue - The text value to be displayed if the boolean value is TRUE If null is set, the default text value (“Yes”) is displayed.
      falseValue - The text value to be displayed if the boolean value is FALSE If null is set, the default text value (“No”) is displayed.
  • Method Details

    • format

      public String format(Object data)
      Formats a value.
      Specified by:
      format in interface ListGridCellFormatter
      Parameters:
      data - The value to be formatted
      Returns:
      The equivalent text value If the value is a Boolean type value and it is true, the return value is the text value for TRUE. Otherwise, the text value for FALSE.