'com.jFormTK' "pre Processor", "post Processor", "do Button" Description:

This document is designed to describe the Java Form Tool Kit [''com.jFormTK''] "pre Processor", "post Processor" and "do Button", features.

Pre Processor / Post Processor Description:

The ''com.jFormTK'' consist of a ‘JFormForm’ Sub-Class for each Application Form with a collection of ‘JFormField’ instances that represent the fields of the Form. The "pre Processor" and "post Processor" capability enables the ''com.jFormTK'' developer to write Java "Code Snippets" that shall be executed in run-time before ["pre Processor"] and / or after ["post Processor"] a specific JFormField receives the focus in the JFormForm.

These "pre Processor" and "post Processor" operations are available for all JFormField "Active" Types, i.e. all but the JFormField "Label [_LField] Type.

To make use of the "pre Processor" or "post Processor" 'com.jFormTK' features the following Java code is required:

  1. In your JFormForm Sub-Class use the following JFormField methods as required:

    a) aField.setpreProcess (boolean preProcessFlag);
    b) aField.setpreProcess (boolean preProcessFlag,
                                           Object preProcessObject);
    c) aField.setpostProcess (boolean postProcessFlag);
    d) aField.setpostProcess (boolean postProcessFlag,
                                            Object postProcessObject);
    where 'aField' is a JFormField instance…
  2. In your JFormForm Sub-Class, OVERRIDE the JFormForm ‘preProcessor’ and ‘postProcessor’ Methods as follows:

public void preProcessor(JFormField fld) {
} // End ‘preProcessor’ Method…

public void postProcessor(JFormField fld) {
} // End ‘postProcessor’ Method…

The respective ‘preProcessObject’ or ‘postProcessObject’ OVERRIDE methods are provided a "Reference" to the JFormField that requested a run-time pre/post Process operation. Generally, the ''com.jFormTK'' developer will use the JFormField ‘getName()’ method to determine what JFormField is to be processed.

For example: String name = fld.getName().

Give the JFormField "Name", the ‘preProcessor’ or ‘post Processor’ OVERRIDE will use a Java ‘IF’ statement or the Java ‘DoCase’ [switch] statement to execute the specific pre/post Processor Code snippet. If a preProcess / postProcess Object was provided by the ‘setpreProcess / setpostProcess’ Method [see 1b) and 1d) above], then a "Reference" to the associated object may be obtained via the JFormField.getPreProcessObject() or JFormField.getPostProcessObject()) Methods. Note that the Object Reference must use a Java Cast operation to successfully process the given Object. For example:

String myString = ((String)aField.getPreProcessObject()).
where aField is a 'JFormField" instance and the Object Variable is a String type
.

Each Java Code Snippet has access to any field [JFormField] of any Application Form [JFormForm Sub-Class] via the Java Form Tool Kit [''com.jFormTK''] "Dynamic Reference" feature. This ''com.jFormTK'' feature is implemented by the ‘AppDB’ Class. See the "Dynamic Reference.doc" file for a complete description on the usage of the ''com.jFormTK'' function.

''com.jFormTK'' Buttons:

The 'com.jFormTK' System has the following collection of Buttons designed to make the Application Form more dynamic.

  1. Group Control Buttons [_AField / _DField]:

    As described in the "repeatMode.doc", the ''com.jFormTK'' has two special Buttons designed to add or delete a "'com.jFormTK' Group" to a JFormForm Sub-Class during run-time. These special Buttons use the "_AField" and "_DField" JFormField Type parameters. These operations are serviced exclusively by the 'com.jFormTK' Kernel.
  2. Person Query Button [_PField]:
    As described in the 'JPerson" doc the 'com.jFormTK.JFormField' _Pfield type is designed to query the Application End User if the next person should be processed within a 'com.jFormTK' Group. This processing is performed directly by the 'com.jFormTK' Kernel once the individuals are setup in the 'JPerson' Class during the Application initialization phase.

Action Buttons [_BField / QField]:
The 'com.jFormTK' Kernel implements two "Action Buttons" via the JFormForm Sub-Class 'doButton' method. The _BField JFormField type is a standard button on the JFormForm that when selected by the Application End User requires some processing to be performed immediately. The _QField JFormField type services an often used sequence where the Application End User is provided a "Query" followed by a "Yes" and a "No" button.

Both of these buttons are processed via the JFormForm Sub-Class 'doButton' Method Override method. The "doButton" method processing is similar to the "pre Processor" and "post Processor" operations.

To make use of the "Action Button" feature the following Java code is required:

  1. In your JFormForm Sub-Class use the following JFormField methods as required:

    a) aField.setDoButton (boolean doButtonFlag);
    b) aField.setDoButton (boolean doButtonFlag,
                                        Object doButtonObject);
    where 'aField' is a JFormField instance.
  2. In your JFormForm Sub-Class, OVERRIDE the JFormForm ‘doButton’ Method as follows:

public void doButton(JFormField fld) {
} // End ‘doButton’ Method…

If a 'doButton' Object is required,
Then the Object is obtained from the host 'JFormField' instance via the following method usage:

String myString = (String)aField.getDoButtonObject();
where aField is a 'JFormField" instance and the Object Variable is a String type.

NOTE:

The 'com.jFormTK' "pre Processor" and "post Processor" operations are available for all of the 'com.jFormTK' JFormField "Active" types, i.e. all JFormField types except the 'com.jFormTK' Label [_LField] type.

For example it is possible to perform a "pre Processor" and "post Processor" operation on a _BField, _QField, _PField, _AField of _DField JFormField type. Doing so may make sense for a _Bfield object but "pre Processor" and "post Processor" operations on any of the other above "Button" types may be tricky because the 'com.jFormTK' Kernel is designed to handle their processing "Under The Hood".

The ‘doButton’ method processing is available only for "_BField" OR "_QField" JFormField types.

Recurrence:

As in the Run-Time Assignment processing the "pre Processor" and "post Processor" 'com.jFormTK' features have "Recurrence" processing to be considered. By default, once a "pre Processor" and "post Processor" operation is performed it is removed from future consideration, i.e. it is generally a one time Run-Time processing operation.

However, this may not always be the requirement for a "pre Processor" and "post Processor" operation. Therefore, the 'com.jFormTK' enables the Application Developer to direct the 'com.jFormTK' Kernel to keep the "pre Processor" and "post Processor" "Active" by setting the "Recurrence" Flag to true. This is accomplished via the following code:

aField.setPreProcessRecurrence(true);
aField.setPostProcessRecurrence(true);
where 'aField' is the JFormField instance...