Microsoft SDK for Java

BooleanDataFormat Class

The BooleanDataFormat class of the com.ms.wfc.data package represents a data format object for formatting boolean data types.

public class BooleanDataFormat extends DataFormat implements IConstructable

{

  // Constructors

  public BooleanDataFormat(String falsevalue, String truevalue);

  public BooleanDataFormat(String falseValue, String trueValue,

    String nullValue);

  // Methods

  public String getFalseValue();

  public String getNullValue();

  public String getTrueValue();

  public void setFalseValue(String value);

  public void setNullValue(String value);

  public void setTrueValue(String value);

}

Remarks

The com.ms.wfc.data.ui.Column and com.ms.wfc.data.ui.DataBinding classes provide a setDataFormat method that 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 data format to a BooleanDataFormat object shown as follows:

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 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);

See Also   DateDataFormat, NumberDataFormat

© 1999 Microsoft Corporation. All rights reserved. Terms of use.