JXFS Printer Service

The JXFSPrt Service, which extends the JXFS Service, sends data from the application to a printer, and communicates with the printer by retrieving data from a context using a special formatter for the printing of forms. This formatter generates an array of strings that is suitable to be sent to the J/XFS Device Control API for forms printing.

The formatter used is the jxfsFormat, which extends the RecordFormat class. This formatter contains the fields expected by a J/XFS Device Control, which does the following:

When the data is found, it is formatted as an array of FieldName-FieldValue pairs for use by the J/XFS Device Control.

An example of a jxfsForm definition in the format definition file is as follows:

<fmtDef id="receipt">
  <jxfsForm dataName="kcollName">
    <fstring dataName="username"/>
    <fDate dataName="date"/>
    <fstring dataName="address"/><jxfsFieldLabel
value="customerAddress"/>
  </jxfsForm>
</fmtDef>

By default, each field's dataName should match the corresponding form field name. If the form field has a different name, the jxfsFieldLabel decorator can be used to override the field name with the form field name. The jxfsForm class accepts any format element, searches in internal jxfsForm tags, and processes indexed collection formats to map indexed form fields.

Note: The form field names correspond to those in a JXFS form that has the same structure as a WOSA form. The form structure is described in a specific form file, so there is a list of form fields names and their features.

The J/XFS form file has a defined set of expected data field names. For simplicity, it is recommended that the corresponding dataName attributes of data fields used in the jxfsForm definitions should use these names. If these names are not used in the form definition then the jxfsFieldLabel decorator can be used to convert the jxfsForm field names to comply with the J/XFS requirements.

The useAllFields parameter is an optional parameter that can be used in the JXFS Service definition tag to control what happens if a field is required by the J/XFS form but that field is not specified in the JXFS form definition. If this attribute is set to "never" the JXFS form fields that are not in the jxfsFormat description are not searched in the context hierarchy. The useAllFields attribute has two options for the value that enables searching for fields of JXFS form definition not included in the jxfsFormat definition; these options affect the action taken if a field is not found in the context hierarchy: setting the value to "always" will cause an exception to be generated (the standard DSEObjectNotFoundException); setting the value to whenPossible no exception will be generated and the search will continue with the next field. An extreme example of how the "always" value could be used is where it is used together with a null jxfsFormat; the effect of this combination is to force a context search to find a value for every field required by the J/XFS form.