Open topic with navigation
Note: The Custom Control Recording Support screen does not open if you are creating a support class for an SWT-based custom class.
To support recording on a custom control, the support class must implement listeners for the events that trigger recording.
The Custom Control Recording Support screen displays the event handler methods implemented by the support class you selected to extend.
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
After you complete the recording-related support information:
If you mapped a new test object class to the custom control, click Next to continue to the New Test Object Class Details Screen.
Otherwise, click Finish to continue to the Custom Control Support Class Summary Screen.
The left pane displays the event handler methods implemented by the base support class. You can select the methods you want to override.
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.
Click Add and select the appropriate listener from the Listener dialog box that opens.
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.
If the selected listener has more than one registration method, select a method from the Registration method list.
Click OK. The listener you selected and all of the event handler methods it includes are added to 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.
The Custom Control Recording Support screen contains the following options:
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 UFT 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 UFT 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.
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:
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.
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.