JDK-8144628 : Provide API to expose list of showing Windows
Type:Enhancement
Component:javafx
Sub-Component:scenegraph
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2015-12-03
Updated:2015-12-10
Resolved:2015-12-10
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
It is generally useful to be able to request a list of all currently showing windows in a UI toolkit. JavaFX lacks this functionality. Attached is a patch that adds this API in to Window as a static getWindows() method.
latest patch as of about 20 minutes ago looks. great. I recommend one minor change (discussed with Jonathan) to testGetWindowsIsObservable to get Windows.getWindows() only once and make sure that reference sees the change.
09-12-2015
API and implementation look good.
One comment on the docs: I recommend to remove the scary paragraph with the strong warning about not holding a reference to a Window. It is true of any API call in JavaFX that gets a reference to a scene graph object (e.g., Stage.getScene() or Scene.getRoot()), so I don't think we should call this one out as being especially problematic.
This will need new unit tests to test the observability and read-only nature of the list.
09-12-2015
Updated patch to provide an unmodifiable ObservableList<Window> instead.
09-12-2015
Patch ready for review - I will ensure that other uses of impl_getWindows() are discovered and updated.
08-12-2015
At a first glance, the API looks good. I'll take a closer look at the docs and implentation later.
Here are a couple other places that reference impl_getWindows that should be fixed for completeness, although they aren't wired up to the build:
apps/experiments/ConferenceScheduleApp/src/main/java/com/javafx/experiments/scheduleapp/pages/SpeakersPage.java: Iterator<Window> itr = Window.impl_getWindows();
tools/ios/Maven/NetBeansMobileCenter/src/main/java/com/sun/javafx/stage/WindowManager.java: final Iterator<Window> allWindows = Window.impl_getWindows();