Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8091563

MenuBar.lookup() and MenuBar.lookupAll() should search Menus/MenuItems (recursively)

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: javafx

      Description

      MenuBar.lookup(String) and MenuBar.lookupAll(String) do not search the Menus and MenuItems added to it directly or indirectly, probably because they do not inherit from Node/Parent.
      Recursive lookup methods are useful for decoupling client code from the actual MenuBar tree structure. This will facilitate flexible and dynamic menus, which would otherwise require maintaining references to all the relevant MenuItems to avoid using brittle hard-coded train wrecks such as menuBar.getMenus().get(2).getItems().get(4).
      GUI unit testing would also greatly benefit from structure-independent lookup methods.

      A related issue is that lookup() and lookupAll() return a Node and a Set<Node>, respectively. Since MenuItem is not a subclass of Node, obviously MenuItem instances cannot be returned.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: