Modify options for recording on Java tables

This task describes how to modify some recording options for recording on Java table, as well as identify the toolkit class for an editor for use with the table_external_editors_list

Modify default JTable recording of SetCellData methods

If the default recording behavior for JTables does not provide the desired value for the SetCellData statement of a particular editor, set that editor to be recorded, like a custom cell editor, in terms of the operation performed on the object inside the cell.

Do one of the following:

  • In the Advanced Java Options Dialog Box, select Table cell controls > Controls to identify as separate test objects, and then specify specific cell editor types that should always be treated as separate objects, and not as part of a JavaTable object.

  • Create a Setting.Java ("table_internal_editors_list") statement.

Back to top

Modify table cell control options

You can specify a list of table cell controls that you want UFT One to identify as separate test object, or for which you want UFT One to record and run JavaTable operations.

  1. In the Advanced Java Options Dialog Box, click the relevant option once to highlight it.

  2. Click the option again or press F2 to open an edit box in which you can add or modify a list of controls.

  3. Change the value as necessary.

    Note: Specify editor class names separated by a space, tab, newline, or return character. Values are case sensitive.

  4. When you finish editing the value, click another location in the dialog box to set the value.

  5. To apply your changes to the currently open test or business component, close the document and then reopen it.

Back to top

Find the toolkit class of a JTable cell editor

If you do not know the value of the toolkit class for an editor for use with the table_external_editors_list variable, you can find it by doing one of the following:

  • Use the Object Spy to retrieve the value.

  • Run a short test in UFT One to retrieve the value. You may want to do this when working with a cell that does not stay activated for long enough to capture the cell with the Object Spy. For example, a cell that is no longer active after a check box is selected or cleared.

  • Create a user-defined function and insert it as a step in your test. You may want to do this when working with business components.

    You can insert steps similar to the following example:

    ' Sample test to retrieve the toolkit class of a table cell editor
    ' that cannot be made continuously active 
    Set table = JavaWindow("TableDemo").JavaTable("Left table").Object
    Set JTableCS = table.mic_get_supp_class()
    Set comp = JTableCS.getComponentAt(table, 0, 6) ‘row 0, col 6
    MsgBox comp.getClass().getName()
    ' Set the value of TABLE_EXTERNAL_EDITORS_LIST
    Setting.Java("TABLE_EXTERNAL_EDITORS_LIST") = comp.getClass().getName()

    Back to top

Find the toolkit class of a JTable cell editor

  1. Open the table and activate a cell in the cell editor column. For example, make sure the cursor is blinking inside an edit field or display the drop-down list of a combo box.

  2. With the appropriate cell activated, use the Object Spy to point to the active cell.

  3. Make sure the Properties tab of the Object Spy is displayed and select the Identification radio button.

  4. In the Properties column, scroll to toolkit class.

  5. In the Values column, select the value of the toolkit class. The value is displayed in the box below the Properties tab.

  6. Copy and paste the value from the Object Spy to the Table cell controls > Controls to identify as separate test objects option or your Setting.Java ("table_internal_editors_list") statement.

Back to top

Modify the click location inside a JTable cell

By default, when you click inside a JTable cell, the click is performed in the middle of the cell.

If you want to click a different point inside of a Java Swing table, modify the following variables:

  • jtable_click_x_percent. Between 1 and 100, lower numbers indicating the left side of the cell, higher numbers indicating the right side.
  • jtable_click_y_percent. Between 1 and 100, lower numbers indicating the top part of the cell, higher numbers indicating the bottom part.

These variables represent a percentage of the width and height of the cell, and specify where to position the click.

For example:

Setting.Java("jtable_click_x_percent") = "10"
Setting.Java("jtable_click_y_percent") = "30"
JavaWindow("SwingSet").JavaTable("Inter-cell spacing:").ClickCell 1,1

Back to top