Creating a Formatter

Create a formatter to transform data coming from a data source for presentation in the UI.

You can create a formatter using one of Nexaweb's supplied tags or by creating a custom tag, for example to turn a custom object returned from a data source into an appropriate string.

For more information on formatters, a list of the Nexaweb supplied formatters, and how to create a custom formatter, see the Nexaweb Platform Data Framework documentation.

You can create a formatter with Nexaweb Studio's Create Formatter wizard using Nexaweb's supplied formatter tags only.

To create a formatter, follow these steps:

1.  To open the Create Formatter wizard, either:

From Nexaweb Data perspective:

From Nexaweb perspective:

  • Right click in the Data view and select New > Formatter

  • Select Tools > Formatter

  • Right click in a UI file and select New > Formatter

  • Select Tools > Formatter

2.  Complete the Create Formatter wizard as follows:
Note: The fields that appear on the Create Formatter wizard differ for each formatter type. For a description of all of the Create Formatter wizard fields, see the Nexaweb Platform Data Framework > Formatters > Supplied Tags documentation.

image\img00594.gif

Formatter Types: Click on the type of formatter to create and click Next.

A dialog appears for you to specify information about the type of formatter you selected.

 

3. Complete the formatter-specific dialog as follows.

image\img00595.gif

Figure 128: DecimalFormatter dialog

Any of the formatter dialogs may include the following fields.

Note: You must click the Advanced to see all of the available fields. Also, for a description of all of the fields that appear for the DateFormatter, see the Data Framework section of the online Nexaweb Developer's Guide.

ID: Specify a system wide unique value to identify this formatter.

Format: Specify a valid java.text.MessageFormat pattern string to use as this formatter.

Locale: A locale string such as, en_US, to specify the format to use for dates included in the data.

In addition to these fields, other fields appear on the dateFormatter dialogs when you click Advanced and on the Formatter dialog, where you define a custom formatter. For a description of these fields, see the documentation on the Nexaweb Dev Center in Data Framework > Formatters.

4. Click Next.

 Nexaweb Studio displays a Formatter Preview dialog. Click Back to change the formatter definition.

5.  Click Finish.

The formatter that you created appears under the Formatters node in the Data view in the Nexaweb Data perspective and in the Outline view in the Nexaweb perspective.

Use a formatter with a binding by either: