How formatters work with application presentation layer and client entities

When a toolkit application presentation layer entity or a toolkit client entity has a formatting or unformatting request, it does not go through the CHA formatter service, but accesses the formatters directly.

The following is a description of how the toolkit converts a context to a formatted string for the toolkit Java(TM) client:

  1. A toolkit Java client needs to convert a context to a string.
  2. The toolkit Java client initializes the formatter instance using an external definition.
  3. The toolkit Java client calls the format method of a formatter instance and passes the context containing the name of the data element instance to be converted. An instance variable in the formatter instance stores the name of the data element that the formatter is to convert.
  4. The formatter converts the data element into a string according to how the formatter was defined.
  5. The formatter might call a decorator to apply additional formatting to the string.

Alternatively, if a toolkit Java client needs to update a context from a formatted string, the process is:

  1. A toolkit Java client needs to convert a string into a context. If needed, the Java client calls one or more decorators to modify the string so that a formatter can process the string.
  2. The toolkit Java client initializes the formatter instance using an external definition.
  3. The toolkit Java client calls the unformat method of the formatter instance and passes the context and the string that requires parsing.
  4. The formatter extracts the substring from the passed string.
  5. If the formatter is a decorator, the format removes the decoration.
  6. The formatter parses the substring.
  7. The formatter the updates the context with the results of parsing the substring.