Custom Control Recording Support Screen

This topic describes the Custom Control Recording Support screen in the New Custom Support Class Wizard, where you define listeners, event handlers, and recording-related options.

Overview

Use this screen to define how recording events are captured for your control. You can override inherited handlers, add listener-based event handlers, and set recording behaviors that affect the generated support class implementation.

Wizard map

Custom Class Selection Screen > Test Object Class Selection Screen > Custom Support Test Object Identification Properties Screen > Custom Support Test Object Methods Screen > Custom Control Recording Support Screen > New Test Object Class Details Screen > Custom Control Support Class Summary Screen

Note: The Custom Control Recording Support screen does not open if you are creating a support class for an SWT-based custom class.

Screen details

The Custom Control Recording Support screen displays the event handler methods implemented by the support class you selected to extend.

Options on this screen

The Custom Control Recording Support screen enables you to:

  • Select methods whose implementation you want to override with new functionality

  • Add new event listeners to implement

  • Set recording-related options

For information on how the wizard implements the details you specify in this screen, see Understanding What the Wizard Adds to the Support Class.

After you complete the recording-related support information:

Methods Inherited from Base Support Class

The left pane displays the event handler methods implemented by the base support class. You can select the methods you want to override.

Additional Methods Required for Test Object Class

In the right pane, you specify the listeners you want to add for the new support class. Each listener you select implies a set of event handler methods you can implement.

Managing listeners

To add a listener to the list:

  1. Click Add and select the appropriate listener from the Listener dialog box that opens.

  2. The list contains the listeners that can be registered on the custom control. The wizard compiles this list by identifying listener registration methods in the custom class and its superclasses. The wizard identifies as registration methods, only methods named add<XXX>Listener whose first argument extends java.util.EventListener.

    If your custom class uses a registration method that does not comply with this definition, you cannot add the corresponding listener using the wizard. You can implement the required support manually after the wizard creates the new custom support class.

  3. If the selected listener has more than one registration method, select a method from the Registration method list.

  4. Click OK. The listener you selected and all of the event handler methods it includes are added to the list.

  5. To remove a listener from the list:

    Select a listener or one of its event handler methods and click Remove.

    Tip: To add event handlers after the support class is created, use the Add Event Handler button or select UFT > Add Event Handler in Eclipse.

Configuration Options

The Custom Control Recording Support screen contains the following configuration options:

Option

Description

Treat controls of this class as wrapper controls

Instructs the wizard to implement the com.mercury.ftjadin.infra.abstr.RecordWrapper interface in the new support class.

If the custom control extends java.awt.container, this check box is selected by default. Otherwise, it is not available.

For more information, see Wrapper Implementation in the Support Class.

Override low-level mouse event recording

Instructs the wizard to implement the mouseRecordTarget method in the new support class so that it returns null.

This instructs OpenText Functional Testing not to record low-level mouse events (coordinate-based operations), so you can record more complex operations, such as, selecting an option in a menu.

Override low-level keyboard event recording

Instructs the wizard to implement the keyboardRecordTarget method in the new support class, so that it returns null.

This instructs OpenText Functional Testing not to record low-level keyboard events, enabling you to record more complex events, such as, setting a value in an edit box.

The options listed in the table above are available only in the wizard (and not in the Eclipse UFT commands that you can use to edit a support class after it is created). If you do not select these options when you create the support class, and you want to implement them later, you will have to do so manually.

Understanding What the Wizard Adds to the Support Class

The following sections describe the methods that the wizard adds to the support class it creates, based on the definitions in Custom Control Recording Support screen:

Listener Implementation in the Support Class

In the support class file it creates, the wizard implements the listeners and options you specified, as follows:

  • The implemented listener interfaces are added to the support class signature.

  • A constructor is added to the support class, listing all of the listeners that need to be registered on the custom control. It also lists the methods used to add and remove the listeners. This is done by calling addSimpleListener for each listener.

  • A method stub is added to the support class for each of the event handler methods you selected in the left pane. The method stubs call the corresponding event handler methods in the base support class. You can implement the new event handler methods to match the needs of your custom control.

    Some of the event handler methods are implemented in existing support classes as final methods, which cannot be overridden. If you select one of these methods in the left pane, the wizard adds an underscore at the beginning of the method name in the method stub that it creates. For example, if you select focusGained, focusLost, keyTyped, keyPressed, or keyReleased, the wizard creates _focusGained, _focusLost, _keyTyped, _keyPressed, or _keyReleased, respectively. Each one of the final methods is implemented to call _<method name> after performing its basic functionality. Therefore, you can override the _<method name> methods to add functionality to these final methods.

  • A method stub is added to the support class for each of the event handlers listed in the right pane. You must implement the event handler methods to call MicAPI.record. (Each method stub includes a comment to remind you to do this, and a basic skeleton which provides a recommendation for the method's structure.) For more information, see Supporting the Record Option.

Wrapper Implementation in the Support Class

You select the Treat controls of this class as wrapper controls check box if you are creating support for a container control that groups the controls within it and represents them as a single control. If you select this check box, the wizard adds the following method stubs to the support class:

  • blockWrappedObjectRecord. (Returns False.)

  • registerWrapperInspector. (A comment is added to remind you to implement this method to register this class as a wrapper of specific control types.)

  • checkWrappedObject. (Returns null.)

  • wrapperRecordMessage. (Returns the record message sent by the wrapped control without performing any intervention.)

You can implement these methods to achieve the required wrapping functionality. For more information, see Supporting Wrapper Controls.

Next steps