Class ListGridBooleanFormatter
java.lang.Object
com.jbstrap.ui.components.listgrid.formatters.ListGridBooleanFormatter
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionCreates the formatter class using the default settings.ListGridBooleanFormatter
(String trueValue, String falseValue) Creates the formatter class and sets TRUE and FALSE values according to the specified custom values. -
Method Summary
-
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
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 Ifnull
is set, the default text value (“Yes”) is displayed.falseValue
- The text value to be displayed if the boolean value is FALSE Ifnull
is set, the default text value (“No”) is displayed.
-
-
Method Details
-
format
Formats a value.- Specified by:
format
in interfaceListGridCellFormatter
- Parameters:
data
- The value to be formatted- Returns:
- The equivalent text value
If the value is a
Boolean
type value and it istrue
, the return value is the text value for TRUE. Otherwise, the text value for FALSE.
-