Example 6: Configuration and Progress

Class Files

This contributed tool is more complex than most of the other examples and includes the following features:

API Documentation

Click the links below to view the API (class) documentation for each of the classes used to implement this contributed tool.

Configuration and Progress - Configure action
Click HERE to view the API documentation for the Configure action UI class.
Configuration and Progress - Listener
Click HERE to view the API documentation for the Listener class.
Configuration and Progress - Run action
Click HERE to view the API documentation for the Run action UI class.
Plug-in Class: NOMADS Interface
Click HERE to view the API documentation for the standard NOMADS interface class that is part of the Plug-in.
Plug-in Class: ProgressLog
Click HERE to view the API documentation for the standard ProgressLog class that is part of the Plug-in.

Source Code

Click the links below to view the source code for each of the classes used to implement this contributed tool.

Do the Work

This contributed tool is accessed from the Contributed Tools menu.

As described above, this contributed tool is broken down into several pieces that work together to deliver the desired functionality to the user.

Configure Action - Listener

When the Configure action is selected for this tool from the Contributed Tools list, the configPerformed() method in the listener is called.

do_ConfigPerformed:

	local oCommon

	oCommon=new("ecCommon")
	oCommon'ConfigGuiDisplay()
	oCommon'processPanel(cConfigUI$, cConfigTitle$)
	drop object oCommon

return
Configure Action - User Interface

The user interface class inherits the standard Plug-in class ecCommonUI which provides base User Interface functionality. A NOMADS panel must be created in a library file and the supporting logic added to this class.

Example - WCaP Configure Action - Configuration panel
Run Action - Listener

When the Run action is selected for this tool from the Contributed Tools list, the do_ActionPerformed() method in the listener called.

do_ActionPerformed:

	enter IExtCommand

	local oCommon

	oCommon=new("ecCommon")
	oCommon'processPanel(cRunUI$, cRunTitle$)
	drop object oCommon

return
Run Action - User Interface

The user interface class inherits the standard Plug-in class com.pvx.util.progress which provides a simple progress log window that includes several buttons to allow user interaction as the work progresses. This class requires the child class to implement a do_work() method to perform the required work for the contributed tool and manage the available features of the interface.

The child class interacts with the user interface using the following methods:

_obj'createLogFile(aNamePfx$) or _obj'createLogFile(aNamePfx$, btnText$)
Use this method to create a temporary log file to update during the execution of the tool; the file will be deleted upon exit of the tool.
  • The aNamePfx$ value will be used as the first part of the log file name; use a value to make it easy to associate the log file with the contributed tool.
  • When the work is complete, a 'View Log' button will display to allow the user to view the log file; use the btnText$ parameter to override the default text for this button.
info When this method is used to create a log file, a 'View Log' button will display when the process is complete.
_obj'enable_cancel()
Use this method to enable the Cancel button.
_obj'checkCancel()
If Cancel has been enabled, the child class must use this method to determine if the user has attempted to cancel the task.
_obj'disable_cancel()
If Cancel has been enabled, the child class should use this method during any portion of work that cannot be aborted (such as an update).
_obj'enable_special(btnText$)
Use this method to show and enable the 'Special' button action after the process has completed. The btnText$ value will be displayed as the text on the button (must not be longer than 10 characters).
info Override the b_special() method to implement an action to perform when the button is clicked. The action can be used to view a detailed log file or special report.
_obj'disable_special()
Use this method to disable the special button.
_obj'writeLog(message$) or _obj'writeLog(message$,logFile$)
Use this method to write the value in the argument message$ to the progress log window. if a logFile$ is specified, the message will also be appended to the file.
_obj'writeLogFile(message$) or _obj'writeLogFile(message$,logFile$)
Use this method to write the value in the argument message$ to the specified log file. When the log file is not specified, the value is written to the file created by the _obj'createLogFile() method.

The following image shows the user interface after the user has cancelled the work in progress.

Example - WCaP Run Action - Work Cancelled

The following image shows the user interface after the user has allowed the work to complete. Notice the WooHoo! button - this button was enabled by calling the _obj'enable_special() method. When the user clicks the button the logic associated with the b_special() method is called.

Example - WCaP Run Action - Work Completed