Methods | This Package | All Packages

BooleanDataFormat Class

Represents a data format object for formatting boolean data types.

DataFormat
  |
  +--BooleanDataFormat

package com.ms.wfc.data

public class BooleanDataFormat
extends
DataFormat
implements
IConstructable

Remarks

The Column and DataBinding classes provide a dataFormat property, which allows you to format numerical, date, or boolean values. For example, if a column in a DataGrid control contains boolean values, you can set its dataFormat property to a BooleanDataFormat object:

import com.ms.wfc.data.*;
import com.ms.wfc.data.ui.*;

/* Retrieve a boolean-valued column in a DataGrid control.
   Assume this column has an index of 1 in the grid. */
Column column1 = dataGrid1.getColumn(1);

/* Format the column by setting its dataFormat
   property. Create a BooleanDataFormat object
   and specify the strings to be displayed for
   false values, true values, and null values. */
column1.setDataFormat(new BooleanDataFormat("F", "T", "--"));

The BooleanDataFormat class provides three properties to format boolean values:

Property Description
falseValue Specifies the string to be displayed for false values. The default string is "False".
trueValue Specifies the string to be displayed for true values. The default string is "True".
nullValue Specifies the string to be displayed for null values. The default string is "(null)".

The following example shows how to reset the strings to their default values:

/* Retrieve the column's current BooleanDataFormat object. */
BooleanDataFormat bFormat = (BooleanDataFormat) column1.getDataFormat();

/* Reset the format strings to the default values 
   by setting the falseValue, trueValue, and
   nullValue properties to null. */
bFormat.setFalseValue(null);
bFormat.setTrueValue(null);
bFormat.setNullValue(null);

For information about formatting boolean values in the Forms Designer, see Formatting Data.

See Also   DateDataFormat, NumberDataFormat