list_ui_components

The list_ui_components command is to enumerate all the UI components inside the windows. Its syntax is described in the Communication Protocol.

Arguments

  • get_windows common arguments
    Before listing the menu bar, JAuto has to target at least a window first. To achieve this, the get_windows mechanism was used. Therefore all the get_windows arguments are supported in this command. Besides these, list_menu has no other arguments.

Output

The output will be written to a file, following the same format as described Communication Protocol. Below is an example output generated by a list_ui_components command call:

javax.swing.JDialog,feature.configure.ah,window:0,x:182,y:129,w:768,h:576,act:1,title:Trader Workstation Configuration (Simulated Trading)
javax.swing.JButton,jtscomponents.hf,x:458,y:667,w:65,h:23,mx:490,my:678,selected:n,text:OK
javax.swing.JButton,jtscomponents.hf,x:533,y:667,w:65,h:23,mx:565,my:678,selected:n,text:Apply
javax.swing.JButton,jtscomponents.hf,x:608,y:667,w:65,h:23,mx:640,my:678,selected:n,text:Cancel
javax.swing.JTree,feature.configure.panels.generic.ConfigurationTree,x:185,y:163,w:295,h:486,mx:332,my:406
javax.swing.JTree(row),Configuration,x:185,y:163,w:111,h:20,mx:240,my:173
javax.swing.JTree(row),Configuration/General,x:205,y:183,w:72,h:16,mx:241,my:191
javax.swing.JTree(row),Configuration/Lock and Exit,x:205,y:199,w:105,h:16,mx:257,my:207
javax.swing.JTree(row),Configuration/Messages,x:205,y:215,w:86,h:16,mx:248,my:223
javax.swing.JTree(row),Configuration/API,x:205,y:231,w:42,h:16,mx:226,my:239
javax.swing.JTree(row),Configuration/API/Settings,x:225,y:247,w:75,h:16,mx:262,my:255
javax.swing.JTree(row),Configuration/API/Precautions,x:225,y:263,w:98,h:16,mx:274,my:271
javax.swing.JTree(row),Configuration/API/News Configuration,x:225,y:279,w:144,h:16,mx:297,my:287
javax.swing.JCheckBox,trader.common.tag.m,x:499,y:251,w:105,h:16,mx:551,my:259,selected:n,text:Read-Only API
javax.swing.JCheckBox,trader.common.tag.m,x:499,y:272,w:595,h:16,mx:796,my:280,selected:n,text:TotalQuantity field may be used to transmit monetary value for BUY orders for mutual funds.
javax.swing.JCheckBox,trader.common.tag.m,x:499,y:293,w:256,h:16,mx:627,my:301,selected:y,text:Download open orders on connection
javax.swing.JCheckBox,trader.common.tag.m,x:499,y:314,w:337,h:16,mx:667,my:322,selected:y,text:Include virtual FX positions when sending portfolio.
javax.swing.JCheckBox,trader.common.tag.m,x:499,y:335,w:306,h:16,mx:652,my:343,selected:y,text:Prepare DailyPnL when downloading positions
javax.swing.JLabel,trader.common.tag.n,x:499,y:377,w:260,h:15,mx:629,my:384,text:Encode API messages, instrument names
javax.swing.JComboBox,,x:769,y:377,w:156,h:14,mx:847,my:384,index:0,text:ASCII 7 (Python, Java, .NET)
javax.swing.JComboBox(row),0,selected:y,text:ASCII 7 (Python, Java, .NET)
javax.swing.JComboBox(row),1,text:OS Code Page (C++)

The first line identifies the window. For details about this line, please refer to get_windows output.

UI components in this window, such as JButton, JTree are listed from the second line below. Attributes are comma-delimited, and mostly follow a field_name:field_value format. The following table describes the meaning of each field:

Unnamed Attribute #1 Java base class name for the component, or the javax. or java. class that the instance class inherited from. (see below for the case with “row”.)
Unnamed Attribute #2 Class name for the component in the target program.
x Screen coordinate x of the component
y Screen coordinate y of the component
w Width of the component
h Height of the component
mx Screen coordinate x of the center point of the component (see notes below)
my Screen coordinate y of the center point of the component
selected Whether a checkbox or a radio button is selected, y for yes and n for no.
text The text associated with the component

Lines containing (row) are special cases. JList, JComboBox, and JTree will trigger enumeration of the contents inside. Each entry (for example, an option for selection in a combobox) uses a whole line that comes immediately after these components.

For JList and JComboBox, the meanings of the fields are:

Unnamed Attribute #1 JList or JComboBox plus (row) respectively, indicating that the line describes an entry inside the previous parent component.
Unnamed Attribute #2 The zero-based index of the entry
selected Whether the entry is selected, y for yes and n for no.
text The text associated with the entry

For JTree, the meanings of the fields are:

Unnamed Attribute #1 JTree plus (row) respectively, indicating that the line describes an entry inside the previous parent component.
Unnamed Attribute #2 The slash-/-delimited “path” for the tree entry
x Screen coordinate x of the component
y Screen coordinate y of the component
w Width of the component
h Height of the component
mx Screen coordinate x of the center point of the component (see notes below)
my Screen coordinate y of the center point of the component

Attributes mx, my are only returned for JTree, enabling mouse clicks. But for both JList and JComboBox, only the index and the selection are returned, enabling only keyboard navigation.

If there is more than one window, the contents will be listed in a sequential format, like:

window-1-line
component-1-in-window-1
component-2-in-window-1
window-2-line
component-1-in-window-2

Notes regarding mx, my: Even though attributes mx and my are returned for all components, there is no guarantee that the coordinates are clickable. When the panels are scrollable, coordinates for certain components might be off-screen. JAuto currently does not automatically determine the visible area of a scrollable panel. When writing automation, you have to determine the components are visible, before you run mouse and keyboard simulations on them. The easiest way to make this happen is to use mx, my to position the mouse in the scrollable panel, and send mouse wheel clicks to scroll.


Copyright © 2022 He Shiming <heshiming at gmail dot com>.