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

Provide possibility to traverse focus out of FX scene

    Details

      Description

      Transparent focus traversal is one of key features of FX/Swing interoperability. This includes both directions:

      1. Transferring focus from Swing to FX. JFXPanel should accept Swing focus and dispatch it to proper SceneGraph nodes.
      2. Transferring focus from FX to Swing. When FX focus reaches the beginning/end of the focus chain, focus should be transferred out to Swing.

      #1 is currently implemented as a part of EmbeddedStageInterface. To support #2, there should be an ability to register a listener for focus "wraps": when TraversalEngine detects that focus reaches the beginning/end of the focus loop, it should ask the listener if it's able to dispatch focus out of FX scene.

        Issue Links

          Activity

          Hide
          art Artem Ananiev added a comment -
          Proposed changes:

          1. Add two methods to TraversalEngine: setTraverseOutListener(), clearTraverseOutListener().

          2. Make Algoritm.traverse() not only return an index of the component to be focused, but also a flag if a focus loop is wrapped at this step.

          3. Add new method to TKScene: traverseOut()

          Then the sequence of traversal will be:

          1. On every set/change scene's root, the scene registers a traverseOutListener on root's traversal engine.

          2. On every forward focus traversal, if the next component to focus is the first one (that is, a wrap will take place), the engine first ask the listener for focus out traversal, and if the listener rejects, makes the first component focused.

          3. The same for backward focus traversal.

          4. Scene's traverseOutListener just forwards the request to the scene peer.

          5. Regular peers (e.g. ViewScene) just return false from traverseOut().

          6. EmbeddedScene.traverseOut() forwards the request to its embedder (HostInterface.traverseFocusOut() method).
          Show
          art Artem Ananiev added a comment - Proposed changes: 1. Add two methods to TraversalEngine: setTraverseOutListener(), clearTraverseOutListener(). 2. Make Algoritm.traverse() not only return an index of the component to be focused, but also a flag if a focus loop is wrapped at this step. 3. Add new method to TKScene: traverseOut() Then the sequence of traversal will be: 1. On every set/change scene's root, the scene registers a traverseOutListener on root's traversal engine. 2. On every forward focus traversal, if the next component to focus is the first one (that is, a wrap will take place), the engine first ask the listener for focus out traversal, and if the listener rejects, makes the first component focused. 3. The same for backward focus traversal. 4. Scene's traverseOutListener just forwards the request to the scene peer. 5. Regular peers (e.g. ViewScene) just return false from traverseOut(). 6. EmbeddedScene.traverseOut() forwards the request to its embedder (HostInterface.traverseFocusOut() method).
          Hide
          psafrata Pavel Šafrata added a comment -
          This issue has been reported as a bug, because without it embedding can't work properly. Changing type from Feature to Bug.
          Show
          psafrata Pavel Šafrata added a comment - This issue has been reported as a bug, because without it embedding can't work properly. Changing type from Feature to Bug.
          Hide
          art Artem Ananiev added a comment -
          RT-24136 is closed as duplicate of this one. Note, however, that is may happen that to make JFXPanel work it's not enough to fix this bug. In that case, RT-24136 will be re-opened to track JFXPanel part of focus traversal.
          Show
          art Artem Ananiev added a comment - RT-24136 is closed as duplicate of this one. Note, however, that is may happen that to make JFXPanel work it's not enough to fix this bug. In that case, RT-24136 will be re-opened to track JFXPanel part of focus traversal.
          Hide
          akirov Alexander Kirov added a comment -
          RULE ControlsAutomatedTestSuite/javafx/scene/control/test/fxcanvas/FXCanvasTest/focusTest Exception java.lang.AssertionError:
          Show
          akirov Alexander Kirov added a comment - RULE ControlsAutomatedTestSuite/javafx/scene/control/test/fxcanvas/FXCanvasTest/focusTest Exception java.lang.AssertionError:

            People

            • Assignee:
              azvegint Alexander Zvegintsev
              Reporter:
              art Artem Ananiev
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: