All Implemented Interfaces:
KeyEventListener
Direct Known Subclasses:
BoardUtils, Console, Dialog

public abstract class Window
extends WindowItem
implements KeyEventListener
General abstraction for a window
  • Field Details

    • enableInputOnReturn

      protected final boolean enableInputOnReturn
      Determines if the console input has to be enabled when closing this
    • returnTo

      protected final CursorPosition returnTo
      The cursor position to restore on window exit
    • cli

      protected final CLI cli
      The View object
    • background

      protected final java.lang.String[][] background
      The window background
  • Constructor Details

    • Window

      public Window​(CLI cli)
      Console constructor
      Creates the initial window, centered
    • Window

      public Window​(Window parent, java.lang.String id)
      Default constructor
      Creates a new Window, loading its settings from file
      Parameters:
      parent - the parent
      id - the Window id
    • Window

      public Window​(Window parent, int width, int height, CursorPosition initCoord, java.lang.String id)
      Custom constructor
      Creates a custom sized window
      Parameters:
      width - the window width
      height - the window height
      initCoord - the window initial coordinates
      parent - the caller
      id - the Window id
  • Method Details

    • getCli

      public CLI getCli()
      cli getter
      Overrides:
      getCli in class WindowItem
      Returns:
      the cli containing this
    • getReturnTo

      public CursorPosition getReturnTo()
      returnTo getter
      Returns:
      the cursor position to restore when closing the window
    • addToBackground

      public void addToBackground​(PrintableObject obj, CursorPosition coord)
      Adds a PrintableObject to the background
      Parameters:
      obj - the printableObject to add
      coord - the starting coordinates of the scene
    • show

      public void show()
      Shows the window on the console
      Overrides:
      show in class WindowItem