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

Promote Scene.impl_getFocusOwner to public API (and clean up focus owner code in Scene)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • javafx

      There are several common use cases for wanting to get the keyboard focus owner in a scene. Two common ones are for the authoring tool and accessibility.

      The proposed solution to this would be to promote impl_getFocusOwner to public API, but it looks like it may not be so trivial. Currently, the focus owner is handled in a couple different ways in Scene.java:

          /**
           * Gets the scene's current focus owner node.
           *
           * TODO: probably should be removed in favor of impl_focusOwner below.
           *
           * @treatasprivate implementation detail
           */
          public Node impl_getFocusOwner() {
              return getKeyHandler().getFocusOwner();
          }

          /**
           * The scene's current focus owner node. This node's "focused"
           * variable might be false if this scene has no window, or if the
           * window is inactive (window.focused == false).
           *
           * TODO this was added because of RT-3930. This needs to be reconciled
           * with impl_getFocusOwner(). We don't need both. Exposing a variable
           * is more powerful because it allows code to bind to it.
           *
           * @treatasprivate implementation detail
           */
          //
          private @GenerateProperty Node impl_focusOwner;

      So, there seems to be opportunity here to clean things up in addition to exposing public API.

            msladecek Martin Sládeček
            wwalkerwse Willie Walker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: