Public API for robot classes in JDK 9
Benjamin Gudehus
hastebrot at gmail.com
Mon Dec 14 10:41:04 UTC 2015
The missing public API for robots (`com.sun.glass.ui.Robot` and
`com.sun.javafx.robot.FXRobot`) is causing me sleepless nights. Here (
https://github.com/TestFX/Robot) is a small prototype for a possible API to
ignite some discussion. In case the proposed delay of JDK 9 (
http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-December/003149.html)
takes place.
About the architecture:
In the prototype I decided to not touch classes in `com.sun.glass.ui` and
instead provide "wrapper" classes. This is a pattern which is also used for
other classes in the JavaFX codebase, to provide a public API for
functionality from e.g. `com.sun.prism` and `com.sun.javafx`. Additionally
`com.sun.glass.ui.Robot` has dependencies to other private classes in its
package and to native bindings to different operating systems and Monocle.
About the implementation:
- `javafx.application.ApplicationMixin::createGlassRobot()` returns a new
`javafx.application.util.GlassRobot`. The methods of `ApplicationMixin`
will of course find their places in `javafx.application.Application`
eventually.
- The `GlassRobot` is in the `javafx.util` package. It could also go into a
new `javafx.robot` package instead. `GlassRobot` uses classes from the
JavaFX API like `KeyCode`, `Point2D` and `MouseButton` instead of primitive
types which are used by `com.sun.glass.ui.Robot`.
(I've created a new mail thread in order to permalink to it and allow
others without JIRA writing access to participate in the discussion. A JIRA
ticket should be definately created via bugs.java.com -- if none already
exist; I'll check this. I also know the code needs to be patch files into
order to be merged into HG.)
--Benjamin
More information about the openjfx-dev
mailing list