JavaMenuFunctions

Last Updated:

Actions for working with Java Swing JMenu objects


[How To Read This Reference]
ResetMenuCache
TC
Reset the cache containing the content of whole menu.
SelectMenuItem
RC RJ TC SE2
Action to select a menuItem according to its text value.
SelectMenuItemContains
RC RJ TC SE2
Action to select a menuItem according to a partial match of its text value.
SelectUnverifiedMenuItem
RJ TC SE2
Action to select a menuItem according to its text value without verification of it's existance.
VerifyMenuItem
RJ TC SE2
Attempts to verify the a particular menuitem exists in a menu.
VerifyMenuItemContains
RJ TC SE2
Attempts to verify the existence of a menuitem found by partial text match.

JavaMenuFunctions::ResetMenuCache
TC

Reset the cache containing the content of whole menu.

Reset the cache containing the content of whole menu.

When we begin to manipulate a new menu, we should call this keyword to reset the cache. This cache is used for verification.


NOTE:
TCFLX : This command is supported

Fields: [ ]=Optional with Default Value
    Examples:
    • T, JavaWindow, JavaMenu, ResetMenuCache
      Reset a cache to contain the whole content of JavaMenu.


    [How To Read This Reference]

    JavaMenuFunctions::SelectMenuItem
    RC RJ TC SE2

    Action to select a menuItem according to its text value.

    In RRAFS, this command will work on both JavaMenu items and JavaPopupMenu items.

    NOTE:
    RJ : When Field5 is provided, the routine first verifies that the specified menuitem exists and exits with error if it does not. If it does exist then the select found menuitem.

    Fields: [ ]=Optional with Default Value
    1. [ TextValue = ]
      Case-sensitive text of menuItem to select OR an App Map reference.

      TextValue is the case-sensitive text of the menuitem to select. Parent-Child relationships are separated by "->".
      Alternatively, the TextValue can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit menu item text in the App Map.

      NOTE:
      TCFLX : The textvalue can use wildcast or regex.

    2. [ indexPath = ]
      The index for item of each level. It is 1-based.

      The index for item of each level. It is 1-based. If there are several menuitem in the same level with same text, this parameter can be used to indicate which one is wanted. Parent-Child relationships are separated by "->".
      Alternatively, the indexPath can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit indexes in the App Map.

      NOTE:
      TCFLX : This parameter is supported.

    Examples:
    • T, WINDOW, FileMenu, SelectMenuItem
      This action selects the FileMenu menuitem as defined in the AppMap.

      This mode is less desirable as it may not work with compatible engines made with tools other than Rational Robot.

    • T, WINDOW, FileMenu, SelectMenuItem, "Exit"
      This action selects the "Exit" menuItem from the FileMenu as defined in the AppMap.

      This mode is less desirable as it may not work with compatible engines made with tools other than Rational Robot.

    • T, WINDOW, AJmenu, SelectMenuItem, "File"
      This action selects the "File" menu.


    • T, WINDOW, AJMenu, SelectMenuItem, "File->Exit"
      This action selects the "Exit" menuitem found in the "File" menu.


    • T, WINDOW, AJmenu, SelectMenuItem, "FileOpen"
      This action selects the menuItem defined in a "FileOpen" subkey of [AJMenu] from within the App Map.


    • T, WINDOW, AJMenu, SelectMenuItem, "File->Exit", "1->2"
      This action selects the 2th "Exit" menuitem found in the 1th "File" menu of menubar.


    • T, WINDOW, AJMenu, SelectMenuItem, "Fil*->[eE]xit"
      This action selects the "Exit" menuitem found in the "File" menu of menubar.

      NOTE:
      TCFLX : "File" is given as a willcast string "Fil*", "Exit" is given as a regex string "[eE]xit".

    [How To Read This Reference]

    JavaMenuFunctions::SelectMenuItemContains
    RC RJ TC SE2

    Action to select a menuItem according to a partial match of its text value.

    In RRAFS, this command will work on both JavaMenu items and JavaPopupMenu items.

    NOTE:
    RJ : When Field5 is provided, the routine first verifies that the specified menuitem exists and exits with error if it does not. If it does exist then the select found menuitem.

    Fields: [ ]=Optional with Default Value
    1. [ TextValue = ]
      Case-insensitive substring of menuItem to select OR an App Map reference.

      Parent-Child relationships are separated by "->"
      Alternatively, the TextValue can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit menu item text in the App Map.
      Note: RJ implementation: this field is required.


    2. [ indexPath = ]
      The index for item of each level. It is 1-based.

      The index for item of each level. It is 1-based. If there are several menuitem in the same level with same text, this parameter can be used to indicate which one is wanted. Parent-Child relationships are separated by "->".
      Alternatively, the indexPath can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit indexes in the App Map.

      NOTE:
      TCFLX : This parameter is supported.

    Examples:
    • T, WINDOW, FileMenu, SelectMenuItemContains, "exi"
      Verify that the FileMenu contains partially path "exi", if exist then select it. For Example: If a path "Exit CTRL+X" exists in the FileMenu, then select it.


    • T, WINDOW, AJMenu, SelectMenuItemContains, "f->exit"
      Verify that the AJMenu contains partially path "f->exit", if exist then select it. For Example: If a path "File->Exit CTRL+X" exists in the FileMenu, then select it.


    • T, WINDOW, AJMenu, SelectMenuItemContains, "file->e", "1->2"
      Verify that the AJMenu contains partially path "file->e" with index as "1->2", if exist then select it. For Example: If a path "File->Exit" and "File->Edit" exists in the MenuBar, as 'File' is the first item found and 'Edit' is the second item patially matched with 'e' under 'File', so "File->Edit" is selected.


    [How To Read This Reference]

    JavaMenuFunctions::SelectUnverifiedMenuItem
    RJ TC SE2

    Action to select a menuItem according to its text value without verification of it's existance.

    Action to select a menuItem according to its text value without verification of it's existance.

    Fields: [ ]=Optional with Default Value
    1. TextValue
      Case-sensitive text of menuItem to select OR an App Map reference.

      TextValue is the case-sensitive text of the menuitem to select. Parent-Child relationships are separated by "->".
      Alternatively, the TextValue can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit menu item text in the App Map.

      NOTE:
      TCFLX : The textvalue can use wildcast or regex.

    2. [ indexPath = ]
      The index for item of each level. It is 1-based.

      The index for item of each level. It is 1-based. If there are several menuitem in the same level with same text, this parameter can be used to indicate which one is wanted. Parent-Child relationships are separated by "->".
      Alternatively, the indexPath can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit indexes in the App Map.

      NOTE:
      TCFLX : This parameter is supported.

    Examples:
    • T, WINDOW, AJmenu, SelectUnverifiedMenuItem, "File"
      This action selects the "File" menu.


    • T, WINDOW, AJMenu, SelectUnverifiedMenuItem, "File->Exit"
      This action selects the "Exit" menuitem found in the "File" menu.


    • T, WINDOW, AJmenu, SelectUnverifiedMenuItem, "FileOpen"
      This action selects the menuItem defined in a "FileOpen" subkey of [AJMenu] from within the App Map.


    • T, WINDOW, AJMenu, SelectUnverifiedMenuItem, "file->edit", "1->2"
      Select path "file->edit" with index as "1->2" under AJMenu without verification. For Example: If two pathes "File->Edit" and "File->Edit" exist in the AJMenu, then select the second "File->Exit".


    • T, WINDOW, AJMenu, SelectMenuItem, "Fil*->[eE]xit"
      This action selects the "Exit" menuitem found in the "File" menu of menubar without verification.

      NOTE:
      TCFLX : "File" is given as a willcast string "Fil*", "Exit" is given as a regex string "[eE]xit".

    [How To Read This Reference]

    JavaMenuFunctions::VerifyMenuItem
    RJ TC SE2

    Attempts to verify the a particular menuitem exists in a menu.

    The menuitem should be specified in the form "Menu->Menu->MenuItem CTRL+V" with the full text (ampersands optional), spaces(if any), and keyboard shortcut text (if any). (The ampersands precede any character in the menuitem that is underlined.)

    This command differs from the WindowFunction.VerifyMenuItem command because here we are actually seeking a JavaMenu component, not a Window that contains a menu. Also, we do not currently verify any state information like the WindowFunctions.VerifyMenuItem command.



    Fields: [ ]=Optional with Default Value
    1. MenuItemText
      Menu->MenuItem hierarchy string to identify which menuitem to find.

      Menu->MenuItem hierarchy string to identify which menuitem to find. This menu hierarchy IS case-sensitive
      TQ String. the full case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The text must include the full text including spaces and any visible shortcut key combinations displayed in the text of the menu item.


    2. [ ExpectedStatus = ]
      Expected status string (or part thereof) of the menuitem.

      Expected status string (or part thereof) to verify. Only "Enabled" "Ungrayed" "Grayed" "Disabled" "Checked" "Unchecked" "Menu With N MenuItems" are supported now.
      Ex: "Enabled Checked" OR "Grayed UnChecked" etc.
      Each item separated by a space will be evaluated separately so the order of the status items does not matter. Only the state information of interest needs to be specified. These status items ARE case-insensitive,space-delimited.


    3. [ indexPath = ]
      The index for item of each level. It is 1-based.

      The index for item of each level. It is 1-based. If there are several menuitem in the same level with same text, this parameter can be used to indicate which one is wanted. Parent-Child relationships are separated by "->".
      Alternatively, the indexPath can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit indexes in the App Map.

      NOTE:
      TCFLX : This parameter is supported.

    Examples:
    • T, JavaWindow, JavaMenu, VerifyMenuItem, "File"
      This action verifies that "File" exists in the menu.


    • T, JavaWindow, JavaMenu, VerifyMenuItem, "Weird->CheckBox", "Enabled Checked"
      This action verifies that "Weird->CheckBox" exists with status "Enabled Checked" in the menu.


    • T, WINDOW, AJMenu, VerifyMenuItem, "file->edit","Enabled", "1->2"
      Verify that the 2th item 'edit' in 1th item 'file' in menubar exists and its status is 'Enabled'


    [How To Read This Reference]

    JavaMenuFunctions::VerifyMenuItemContains
    RJ TC SE2

    Attempts to verify the existence of a menuitem found by partial text match.

    Attempts to verify the existence of a menuitem found by partial text match. The menuitem should be specified in the form "Menu->Menu->MenuItem". (Optional ampersands precede any character in the menuitem that is underlined.)

    This command differs from the WindowFunction.VerifyMenuItemContains command because here we are actually seeking a JavaMenu component, not a Window that contains a menu. Also, we do not currently verify any state information like the WindowFunctions.VerifyMenuItemContains command.



    Fields: [ ]=Optional with Default Value
    1. MenuItemText
      Menu->MenuItem hierarchy string to identify which menuitem to find.

      Menu->MenuItem hierarchy string to identify which menuitem to find. This menu hierarchy IS case-sensitive
      TQ String. the case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The text can be any substring of the full text including spaces and any visible shortcut key combinations displayed in the text of the menu item.


    2. [ ExpectedStatus = ]
      Expected status string (or part thereof) of the menuitem.

      Expected status string (or part thereof) to verify. Only "Enabled" "Ungrayed" "Grayed" "Disabled" "Checked" "Unchecked" "Menu With N MenuItems" are supported now.
      Ex: "Enabled Checked" OR "Grayed UnChecked" etc.
      Each item separated by a space will be evaluated separately so the order of the status items does not matter. Only the state information of interest needs to be specified. These status items ARE case-insensitive,space-delimited.


    3. [ indexPath = ]
      The index for item of each level. It is 1-based.

      The index for item of each level. It is 1-based. If there are several menuitem in the same level with same text, this parameter can be used to indicate which one is wanted. Parent-Child relationships are separated by "->".
      Alternatively, the indexPath can be an App Map reference item used in conjunction with the Component Name (field #3) that allows us to store explicit indexes in the App Map.

      NOTE:
      TCFLX : This parameter is supported.

    Examples:
    • T, JavaWindow, JavaMenu, VerifyMenuItemContains, "Fil->Sav"
      Verify that the JavaMenu contains partially path "Fil->Sav". For Example: If a path "File->Save" exists in the JavaMenu, then the verification is ok.


    • T, JavaWindow, JavaMenu, VerifyMenuItemContains, "Fil->Sav","Enabled"
      Verify that the JavaMenu contains partially path "Fil->Sav" and it's status is "Enabled". For Example: If a path "File->Save" exists in the JavaMenu and it's status is "Enabled", then the verification is ok.


    • T, WINDOW, AJMenu, VerifyMenuItemContains, "fi->e","Enabled", "1->2"
      Verify that the partially matched 2th item 'e' in 1th item 'fi' in menubar exists and its status is 'Enabled' For Example: If two pathes "File->Edit" and "File->Exit" exist in the menubar AJMenu, the path "File->Exit" will be found, and if its status is "Enabled", then the verification is ok.


    [How To Read This Reference]