Adding a dialog

About this task

Each of these files are created or modified by creating a dialog:

Files created:

  • a dialog definition XML file, newDialog.xml to describe the panel
  • resource bundle files, for example, MySampleResource_locale.properties
  • HTML help files for your users
  • custom Java command files, for example, MyCommand.java
  • JSP and JavaScript files to fill panel contents, for example myPanel.js and myPanel.JSP

Files modified:

  • resources.xml
  • Tools User Interface Center menu XML file to display your new dialog
  • Tools User Interface Center Help Map XML file to include your help files

To add a dialog:

Procedure

  1. Create a dialog definition XML file that describes the flow among panels and data bean usage. Create the file, for example, named newDialog .xml, in the WC_installdir/xml/tools/ componentname, where componentname is the name of the component to which the dialog belongs.

    For more information, see Dialog definition.

  2. Register the dialog definition XML file in the appropriate resources.xml file.

    Multiple versions of this file exist, one for each component, in this directory:

    • WC_installdir/xml/tools/componentname/resources.xml
    • WebSphere Commerce Developer workspace_dir/wc/xml/tools/componentname/resources.xml

    Make an entry in resources.xml that is similar to this example:

    <XML name="sampleDialog"
    file="componentname/newDialog.xml"/>

    The name attribute becomes a key which will be used in a future step.

    Since the WebSphere Commerce configuration file references the resources.xml files, you must also update the WebSphere Commerce configuration file to register any new resources.xml files.


  3. Write panels using JSP files and JavaScript. These JSP files define the panels that display in the content frame into which users enters data. This table describes the required JavaScript functions:

    Function Name Description
    savePanelData() Stores HTML form data into model (parent frame). This function savePanelData() must be supplied in each content frame to save the current panel's data in the model.
    validateNotebookPanel() An optional function which validates data entered by user.
  4. Write custom commands to update the database and perform custom functionality. These commands update the database with the information entered, or perform some function when the user clicks OK. If the dialog is called using a viewCommand, you must write a custom viewCommand.
  5. Register custom commands and JSP files in the database. Once any required commands are created, register them in the database. Ensure that the URL field in the database matches the value of the finishURL attribute in your XML file. For details on how to register commands see Design patterns.

  6. Create a resource bundle adding text that appears as the title of the dialog. Locate these files in this directory:

    • WC_eardir/properties/com/ibm/commerce/tools/componentname/properties
    • WebSphere Commerce Developer workspace_dir/wc/properties/com/ibm/commerce/tools/ componentname/properties

    where componentname is the component to which you are adding the dialog.

    If national languages are supported, create the national language resource bundles with the appropriate language text. The national language file names must end with the locale supported. For example, for a French-language resource bundle, the file name should be filename_fr_FR.properties

  7. (Optional) Write context sensitive help files for your dialog and update a Tools User Interface Center help map XML file to include your help files. See Adding context-sensitive help into the Tools User Interface Center for more information.
  8. Add your new dialog to a Tools User Interface Center menu system, for example, WebSphere Commerce Accelerator. Refer to Integrating tools into the Tools User Interface Center for more information.
  9. Complete these steps to launch and test your dialog:

    Stop and start WebSphere Commerce then test your new dialog. This is the URL of the newly created dialog:

    https:// host_name :8000/webapp/wcs/tools/servlet/DialogView?XMLFile= namespace.myTestDialog,

    where namespace is defined in resources.xml.