Interface WindowBasedTextGUI

  • All Superinterfaces:
    TextGUI
    All Known Implementing Classes:
    MultiWindowTextGUI

    public interface WindowBasedTextGUI
    extends TextGUI
    Extension of the TextGUI interface, this is intended as the base interface for any TextGUI that intends to make use of the Window class.
    • Method Detail

      • getWindowManager

        WindowManager getWindowManager()
        Returns the window manager that is currently controlling this TextGUI. The window manager is in charge of placing the windows on the surface and also deciding how they behave and move around.
        Returns:
        Window manager that is currently controlling the windows in the terminal
      • addWindow

        WindowBasedTextGUI addWindow​(Window window)
        Adds a window to the TextGUI system, depending on the window manager this window may or may not be immediately visible. By adding a window to the GUI, it will be associated with this GUI and can receive focus and events from it. This method call will return immediately, if you want the call to block until the window is closed, please use addWindowAndWait(..). Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will render windows in a predictable order from bottom to top. You can modify the stack by using moveToTop(..) to move a Window from its current position in the stack to the top.
        Parameters:
        window - Window to add to the GUI
        Returns:
        The WindowBasedTextGUI Itself
      • addWindowAndWait

        WindowBasedTextGUI addWindowAndWait​(Window window)
        Adds a window to the TextGUI system, depending on the window manager this window may or may not be immediately visible. By adding a window to the GUI, it will be associated with this GUI and can receive focus and events from it. This method block until the added window is removed or closed, if you want the call to return immediately, please use addWindow(..). This method call is useful for modal dialogs that requires a certain user input before the application can continue. Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will render windows in a predictable order from bottom to top. You can modify the stack by using moveToTop(..) to move a Window from its current position in the stack to the top.
        Parameters:
        window - Window to add to the GUI
        Returns:
        The WindowBasedTextGUI Itself
      • removeWindow

        WindowBasedTextGUI removeWindow​(Window window)
        Removes a window from the TextGUI. This is effectively the same as closing the window. The window will be unassociated from this TextGUI and will no longer receive any events for it. Any threads waiting on the window to close will be resumed.
        Parameters:
        window - Window to close
        Returns:
        The WindowBasedTextGUI itself
      • getWindows

        java.util.Collection<Window> getWindows()
        Returns a list of all windows currently in the TextGUI. The list is unmodifiable and just a snapshot of what the state was when the method was invoked. If windows are added/removed after the method call, the list will not reflect this.
        Returns:
        Unmodifiable list of all windows in the TextGUI at the time of the call
      • setActiveWindow

        WindowBasedTextGUI setActiveWindow​(Window activeWindow)
        Selects a particular window to be considered 'active' and receive all input events
        Parameters:
        activeWindow - Window to become active and receive input events
        Returns:
        The WindowBasedTextGUI itself
      • getActiveWindow

        Window getActiveWindow()
        Returns the window which the TextGUI considers the active one at the time of the method call. The active window is generally the one which relieves all keyboard input.
        Returns:
        Active window in the TextGUI or null
      • getBackgroundPane

        BasePane getBackgroundPane()
        Returns the container for the background, which works as a single large component that takes up the whole terminal area and is always behind all windows.
        Returns:
        The BasePane used by this WindowBasedTextGUI
      • moveToTop

        WindowBasedTextGUI moveToTop​(Window window)
        Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will render windows in a predictable order from bottom to top. This method allows you to move a Window from its current position in the stack to the top, meaning it will be rendered last. This mean it will overlap all other windows and because of this visually appear on top.
        Parameters:
        window - Window in the stack to move to the top position
        Returns:
        The WindowBasedTextGUI Itself
      • cycleActiveWindow

        WindowBasedTextGUI cycleActiveWindow​(boolean reverse)
        Takes the previously active window and makes it active, or if in reverse mode, takes the window at the bottom of the stack, moves it to the front and makes it active.
        Parameters:
        reverse - Direction to cycle through the windows
        Returns:
        The WindowBasedTextGUI Itself
      • waitForWindowToClose

        void waitForWindowToClose​(Window abstractWindow)
        Waits for the specified window to be closed
        Parameters:
        abstractWindow - Window to wait for