Adding a Workflow Walkthrough

A workflow is a sequence of steps. In this example, we will add a workflow window that contains 4 identical steps. This workflow will be accessible from the Tools menu.

Reviewing Dependencies

The creation of a menu item requires one INT module that is part of the INTViewer platform:

  • IntviewerCore

See the list of INTViewer modules to load the INTViewer platform and for a description of each module.

Creating your module template using NetBeans wizard

  • Click File -> New Project
  • In the New Project wizard select NetBeans Modules from the Categories list and Module from the Projects list and click Next >
  • For Project Name, specify mydemoworkflowmodule
  • Select option Standalone Module and make sure to specify the INTViewer platform in the NetBeans Platform field.
  • Click Next > and specify com.mycompany.myviewer.mydemoworkflow for the Code Name Base and MyDemoWorkflowModule for the Module Display Name.
  • Check Generate XML Layer (if this option is not present, check the Registering the layer.xml file article)
  • Click on Finish

  • In the Projects tree view, you should see your project which includes a number of files that have been created for you

Configuring your Module

  • In the Projects tree, right click on the module MyDemoWorkflowModule and select Properties from the list.
  • Under Categories, select Libraries.
  • Select Java plaform JDK1.7 . If you don't see this option, you will need to install jdk1.7 and load it into NetBeans using option Tools->Java Platforms
  • Click on the Add button next to Module Dependencies
  • In the list, select IntviewerCore and click OK.
  • Click OK in Project Properties Dialog

Creating a Task class

    • In the Projects tree, right click on the module MyDemoWorkflowModule and select New -> Java Class... from the list.
    • Enter DemoWorkflowTask as Class Name and select com.mycompany.myviewer.mydemoworkflow as Package.

  • Make this class extend AbstractTask
  • Automatically add an import for AbstractTask
  • Automatically create the skeleton of required methods for this class
  • Customize the runTask implementation as follow:

This requires the import of com.interactive.intviewerapi.util.DialogManager.

  • Add a constructor method as follow:

You can download the DemoWorkflowTask.java from the attachments at the bottom of this page.

Creating a Task Factory class

    • In the Projects tree, right click on the module MyDemoWorkflowModule and select New -> Java Class... from the list.
  • Enter DemoWorkflowTaskFactory as Class Name
  • Make this class implement ITaskFactory
  • Automatically add an import for ITaskFactory
  • Automatically create the skeleton of required methods for this class
  • Customize the class' implementation as follow:

You can download the DemoWorkflowTaskFactory.java file from the attachments at the bottom of this page.

Registering the Task Factory as Service

    • In the Projects tree, right click on the Source Packages folder of the MyDemoWorkflowModule module, and select New -> Folder... from the list.
  • If a Folder option is not available then select New -> Other and select Folder from the "Other" section in the options list and click next.
  • Enter META-INF as Folder Name
  • Click Finish
    • In the Projects tree, right click on the Source Packages/META-INF folder of the MyDemoWorkflowModule module, and select New -> Folder... from the list.
  • Enter services as Folder Name
  • Click Finish
    • In the Projects tree, right click on the Source Packages/META-INF.services folder of the MyDemoWorkflowModule module, and select New -> Empty File... from the list.
  • Enter com.interactive.intviewerapi.plugins.workflow.ITaskFactory as File Name
  • Click Finish
  • Enter com.mycompany.myviewer.mydemoworkflow.DemoWorkflowTaskFactory in the first line of that file

Defining the Workflow

    • In the Projects tree, right click on the com.mycompany.myviewer.mydemoworkflow folder of the MyDemoWorkflowModule module, and select New -> Empty File... from the list.
  • If an Empty File option is not available then select New -> Other and select Empty File from the "Other" section in the options list and click next.
  • Enter DemoWorkflowTasks.xml as File Name
  • Click Finish
  • Customize the file's content as follow:

You can download the DemoWorkflowTasks.xml file from the attachments at the bottom of this page.

Creating an Action class

    • In the Projects tree, right click on the com.mycompany.myviewer.mydemoworkflow folder of the MyDemoWorkflowModule module, and select New -> Java Class... from the list.
  • Enter DemoWorkflowAction as Class Name
  • Click Finish
  • Make this class implement ActionListener
  • Automatically add an import for ActionListener
  • Automatically create the skeleton of required methods for this class
  • Customize the class's implementation as follow:

You can download the DemoWorkflowAction.java file from the attachments at the bottom of this page.

Adding a Menu Item

  • Customize the layer.xml file as follow:

A walkthrough is available to better understand how actions and menu items are in NetBeans.

You can download the layer.xml file from the attachments at the bottom of this page.

Running the Workflow

  • Click the green arrow
  • Open the Tools menu
  • Select DemoWorkflowDisplayName

More information about workflows is available in the references section.