Class WindowFinderImpl

  • All Implemented Interfaces:
    WindowFinder

    public class WindowFinderImpl
    extends java.lang.Object
    implements WindowFinder
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javafx.stage.Window lastTargetWindow  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int calculateWindowProximityTo​(javafx.stage.Window targetWindow, javafx.stage.Window window)  
      private java.util.List<javafx.stage.Window> fetchWindowsByProximityTo​(javafx.stage.Window targetWindow)  
      private java.util.List<javafx.stage.Window> fetchWindowsInQueue()  
      private boolean hasStageTitle​(javafx.stage.Stage stage, java.lang.String stageTitleRegex)  
      private java.util.function.Predicate<javafx.stage.Window> hasStageTitlePredicate​(java.lang.String stageTitleRegex)  
      private boolean isOwnerOf​(javafx.stage.Window window, javafx.stage.Window targetWindow)  
      java.util.List<javafx.stage.Window> listTargetWindows()
      Returns a list of windows that are ordered by proximity to the last target window.
      java.util.List<javafx.stage.Window> listWindows()
      private java.util.List<javafx.stage.Window> orderWindowsByProximityTo​(javafx.stage.Window targetWindow, java.util.List<javafx.stage.Window> windows)  
      private javafx.stage.Window retrieveOwnerOf​(javafx.stage.Window window)  
      javafx.stage.Window targetWindow()
      Returns the last stored target window.
      void targetWindow​(int windowIndex)
      Stores the window returned from WindowFinder.window(int) as the new last target window.
      void targetWindow​(java.lang.String stageTitleRegex)
      Stores the stage whose title matches the given regex as the new last target window.
      void targetWindow​(java.util.function.Predicate<javafx.stage.Window> predicate)
      Stores the first window that is closes by proximity to the last stored target window and passes the given predicate as the new last target window or throws a NoSuchElementException if none exist.
      void targetWindow​(java.util.regex.Pattern stageTitlePattern)
      Stores the stage whose title matches the given regex as the new last target window.
      void targetWindow​(javafx.scene.Node node)
      Stores the given node's scene's window as the new last target window.
      void targetWindow​(javafx.scene.Scene scene)
      Stores the given scene's window as the new last target window.
      void targetWindow​(javafx.stage.Window window)
      Stores the given window as the target window.
      javafx.stage.Window window​(int windowIndex)
      Returns the window at the given index from the list of windows that are ordered by proximity to the last stored target window.
      javafx.stage.Window window​(java.lang.String stageTitleRegex)
      Returns the stage whose title matches the given regex.
      javafx.stage.Window window​(java.util.function.Predicate<javafx.stage.Window> predicate)
      Calls WindowFinder.listTargetWindows() and returns the first window that passes the predicate or throws a NoSuchElementException if none exist.
      javafx.stage.Window window​(java.util.regex.Pattern stageTitlePattern)
      Returns the stage whose title matches the given regex.
      javafx.stage.Window window​(javafx.scene.Node node)
      Returns the node's scene's window.
      javafx.stage.Window window​(javafx.scene.Scene scene)
      Returns the scene's window.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lastTargetWindow

        private javafx.stage.Window lastTargetWindow
    • Constructor Detail

      • WindowFinderImpl

        public WindowFinderImpl()
    • Method Detail

      • targetWindow

        public javafx.stage.Window targetWindow()
        Description copied from interface: WindowFinder
        Returns the last stored target window.
        Specified by:
        targetWindow in interface WindowFinder
      • targetWindow

        public void targetWindow​(javafx.stage.Window window)
        Description copied from interface: WindowFinder
        Stores the given window as the target window.
        Specified by:
        targetWindow in interface WindowFinder
      • targetWindow

        public void targetWindow​(java.util.function.Predicate<javafx.stage.Window> predicate)
        Description copied from interface: WindowFinder
        Stores the first window that is closes by proximity to the last stored target window and passes the given predicate as the new last target window or throws a NoSuchElementException if none exist.
        Specified by:
        targetWindow in interface WindowFinder
      • listTargetWindows

        public java.util.List<javafx.stage.Window> listTargetWindows()
        Description copied from interface: WindowFinder
        Returns a list of windows that are ordered by proximity to the last target window.
        Specified by:
        listTargetWindows in interface WindowFinder
      • window

        public javafx.stage.Window window​(java.util.function.Predicate<javafx.stage.Window> predicate)
        Description copied from interface: WindowFinder
        Calls WindowFinder.listTargetWindows() and returns the first window that passes the predicate or throws a NoSuchElementException if none exist.
        Specified by:
        window in interface WindowFinder
      • targetWindow

        public void targetWindow​(java.lang.String stageTitleRegex)
        Description copied from interface: WindowFinder
        Stores the stage whose title matches the given regex as the new last target window.
        Specified by:
        targetWindow in interface WindowFinder
      • targetWindow

        public void targetWindow​(java.util.regex.Pattern stageTitlePattern)
        Description copied from interface: WindowFinder
        Stores the stage whose title matches the given regex as the new last target window.
        Specified by:
        targetWindow in interface WindowFinder
      • targetWindow

        public void targetWindow​(javafx.scene.Scene scene)
        Description copied from interface: WindowFinder
        Stores the given scene's window as the new last target window.
        Specified by:
        targetWindow in interface WindowFinder
      • targetWindow

        public void targetWindow​(javafx.scene.Node node)
        Description copied from interface: WindowFinder
        Stores the given node's scene's window as the new last target window.
        Specified by:
        targetWindow in interface WindowFinder
      • window

        public javafx.stage.Window window​(int windowIndex)
        Description copied from interface: WindowFinder
        Returns the window at the given index from the list of windows that are ordered by proximity to the last stored target window.
        Specified by:
        window in interface WindowFinder
      • window

        public javafx.stage.Window window​(java.lang.String stageTitleRegex)
        Description copied from interface: WindowFinder
        Returns the stage whose title matches the given regex.
        Specified by:
        window in interface WindowFinder
      • window

        public javafx.stage.Window window​(java.util.regex.Pattern stageTitlePattern)
        Description copied from interface: WindowFinder
        Returns the stage whose title matches the given regex.
        Specified by:
        window in interface WindowFinder
      • window

        public javafx.stage.Window window​(javafx.scene.Scene scene)
        Description copied from interface: WindowFinder
        Returns the scene's window.
        Specified by:
        window in interface WindowFinder
      • window

        public javafx.stage.Window window​(javafx.scene.Node node)
        Description copied from interface: WindowFinder
        Returns the node's scene's window.
        Specified by:
        window in interface WindowFinder
      • fetchWindowsInQueue

        private java.util.List<javafx.stage.Window> fetchWindowsInQueue()
      • fetchWindowsByProximityTo

        private java.util.List<javafx.stage.Window> fetchWindowsByProximityTo​(javafx.stage.Window targetWindow)
      • orderWindowsByProximityTo

        private java.util.List<javafx.stage.Window> orderWindowsByProximityTo​(javafx.stage.Window targetWindow,
                                                                              java.util.List<javafx.stage.Window> windows)
      • calculateWindowProximityTo

        private int calculateWindowProximityTo​(javafx.stage.Window targetWindow,
                                               javafx.stage.Window window)
      • isOwnerOf

        private boolean isOwnerOf​(javafx.stage.Window window,
                                  javafx.stage.Window targetWindow)
      • retrieveOwnerOf

        private javafx.stage.Window retrieveOwnerOf​(javafx.stage.Window window)
      • hasStageTitlePredicate

        private java.util.function.Predicate<javafx.stage.Window> hasStageTitlePredicate​(java.lang.String stageTitleRegex)
      • hasStageTitle

        private boolean hasStageTitle​(javafx.stage.Stage stage,
                                      java.lang.String stageTitleRegex)