Customize the Step Processor Sample

This topic describes how to customize (or extend) the Java Step Processor sample applet. Refer to the Java Step Sample Files topic for a detailed list of the available sample files. These procedures assume that you have already:

Customizing the Step Processor sample consists of two key steps:

  1. Create a new version of the sample Step Processor
  2. Customize the code (for example, by adding additional user controls)

Note These procedures assume you are using the Java SDK in native, command line mode (see Configure the Java SDK for details on which JDK to use for your development environment and how to install it for eProcess) and that the JDK is installed in the default directory. If you are using a Java Integrated Development Environment (IDE), such as Visual Cafe, JBuilder, Forte, etc., you can use the eProcess Java UI Toolkit API Rapid Application Development (RAD) components, in a drag-and-drop fashion, by adding the vwpanel.jar file to the Java project (for additional information, see the Java UI Toolkit Overview topic). The eProcess Java UI Toolkit provides ready-to-use user controls to simplify customizing the applet user interface. Refer to the documentation that came with your IDE for information on adding drag-and drop RAD components.

Create a new version of the sample Step Processor

These procedures demonstrate how to modify and compile customized versions of the Step Processor samples. However, you can adapt these procedures to update the Launch Step Processor samples by changing the directory and file names used in these procedures.

  1. Navigate to the \vwpanel directory, copy the directory and rename the \samplestep directory (typically to reflect the name of your customization goal). For example, \newstep.

Caution You should rename the directory to ensure that package names do not conflict when you create the Java ARchive (JAR) file (see step 7 below).

  1. Change to the renamed directory.
  2. Rename the following sample files, by adding a prefix, to match your customization. For example, you might rename the files as shown:
  3. Open each renamed file, and replace every occurrence of samples.vwpanel.samplestep with the name of your new directory, which reflects the package structure. For example, if your new directory is called \newstep, replace samples.vwpanel.samplestep with samples.vwpanel.newstep.
  4. Open each renamed file, and replace every occurrence of VWSample with the prefix you added to the file name. For example, in the example shown above, you would replace VWSample with new.  All class definitions must match the files names.
  5. Compile the samples by entering a command similar to the following (modify for the appropriate JDK):
  6. C:\jdk1.3.1\bin\javac.exe -classpath .;C:\<your directory>\pw.jar;%CLASSPATH% newStepApplet.java

    Alternatively, you can compile all of the classes in the directory at once (assuming, for example, that you have already created a batch file that includes the pw.jar location in the CLASSPATH variable; for details, see the Configure the Java SDK topic), as follows:

    setenv
    C:\jdk1.3.1\bin\javac.exe -classpath .;C:\<your directory>\pw.jar;%CLASSPATH% *.java

Note The complete pathname for javac.exe is not necessary if your system PATH variable already includes the corresponding javac.exe.

Caution You must replace all directory name (package) occurrences; if you receive errors messages stating that certain symbols could not be resolved or found, check the files listed in the error statements to ensure that all package names are correct.

  1. Create a new JAR file containing your customized Step Processor.
  2. Sign the JAR file.
  3. Deploy the updated Step Processor applet on the Web WorkFlo server.
  4. As a test, run the new applet to make sure you can use it.

If the new custom Step Processor works, you are ready to customize the Step Processor application/applet code (see below).

Customize the Code

This section describes how to add user interface controls to the custom Step Processor by adding simple fields to indicate when the Step Processor was sent (launch information) and who sent it (originator information).

  1. Using a text editor, open the renamed <prefix>stepPanel.java file (where the <prefix> is the prefix you appended to the file earlier).
  2. Define the new controls by adding the following statements at the end of the DECLARE CONTROLS sections (near the bottom of the file):

//Create labels for the launch date and originator information.

javax.swing.JLabel sentLabel = new javax.swing.JLabel();
javax.swing.JLabel fromLabel = new javax.swing.JLabel();

//Create label objects for the launch date and originator information.

filenet.vw.toolkit.runtime.step.beans.VWLabel vwSentLabel = new filenet.vw.toolkit.runtime.step.beans.VWLabel();
filenet.vw.toolkit.runtime.step.beans.VWLabel vwFromLabel = new filenet.vw.toolkit.runtime.step.beans.VWLabel();

  1. Locate the following statement, and change the position values to move the icon out of the current position to make room for the new fields.

iconLabel.setBounds(516,48,216,108);

Modify the values to change the location of the icon. For example you might enter the following values:

iconLabel.setBounds(20,48,216,108);

  1. Define the launch date information by adding the following statements to the code, in the INIT_CONTROLS section:

//Display the label text on the JPanel to specify what the launch date information means.

sentLabel.setText("Launched on:");
add(sentLabel);
sentLabel.setBounds(320,84,100,24);

//Retrieve and display the launch date for Step Processor.

vwSentLabel.setParameterName("F_LaunchDate");
add(vwSentLabel);
vwSentLabel.setBounds(430,84,100,24);

  1. Define the originator information by adding the following statements to the code:

//Display the label text on the JPanel to indicate what the originator information means.

sentLabel.setText("Step Originator:");
add(fromLabel);
fromLabel.setBounds(320,120,100,24);

//Retrieve and display the originator information.

vwFromLabel.setParameterName("F_Originator");
add(vwFromLabel);
vwFromLabel.setBounds(430,120,180,24);

  1. Save the changes and close the file.
  2. Compile the samples by entering a command similar to the following (modify for the appropriate JDK):

C:\jdk1.3.1\bin\javac.exe -classpath .;C:\<your directory>\pw.jar;%CLASSPATH% newStepApplet.java

Alternatively, enter a command similar to the following to compile all of the classes in the directory at once:

C:\jdk1.3.1\bin\javac.exe -classpath .;C:\<your directory>\pw.jar;%CLASSPATH% *.java

Caution You must replace all directory name (package) occurrences; if you receive errors messages stating that certain symbols couldn't be resolved or found, check the files listed in the error statements to ensure that all package names are correct.

  1. Create a new JAR file containing your newly customized Step Processor.
  2. Replace the JAR file you installed earlier on the Web WorkFlo server, with this updated version.
  3. As a test, run the new applet to make sure the changes are visible and that the applet works.