Class WindowsManager

java.lang.Object
app.ui.windows.WindowsManager
All Implemented Interfaces:
ICallBack

public class WindowsManager extends Object implements ICallBack
Class responsible for managing multiple windows. This class provides a framework for managing a collection of windows in a user interface. It allows for adding and switching between windows, handling user input, and rendering the currently active window.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WindowsManager(com.googlecode.lanterna.screen.Screen screen, int x, int y)
    Constructor for WindowsManager.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addWindow(Window window)
    Adds a window to the window manager.
    void
    draw(int x, int y)
    Draws the currently active window on the screen.
    void
    keyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke)
    Handles a key stroke event for the currently active window.
    void
    onWindowFinished(int chose, String choseString)
    Called when a window action is completed.
    void
    switchFrom(int fromIndex, int toIndex, int ms, int directionX, int directionY)
    Switches from one window to another with a transition effect.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WindowsManager

      public WindowsManager(com.googlecode.lanterna.screen.Screen screen, int x, int y)
      Constructor for WindowsManager.
      Parameters:
      screen - The screen where windows will be managed.
      x - The X position for window management.
      y - The Y position for window management.
  • Method Details

    • addWindow

      public void addWindow(Window window)
      Adds a window to the window manager.
      Parameters:
      window - The window to add.
    • switchFrom

      public void switchFrom(int fromIndex, int toIndex, int ms, int directionX, int directionY)
      Switches from one window to another with a transition effect.
      Parameters:
      fromIndex - The index of the window to switch from.
      toIndex - The index of the window to switch to.
      ms - The duration of the transition in milliseconds.
      directionX - The X direction of the transition.
      directionY - The Y direction of the transition.
    • draw

      public void draw(int x, int y)
      Draws the currently active window on the screen.
      Parameters:
      x - The X position to draw the window at.
      y - The Y position to draw the window at.
    • keyStroke

      public void keyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke)
      Handles a key stroke event for the currently active window.
      Parameters:
      keyStroke - The key stroke event to handle.
    • onWindowFinished

      public void onWindowFinished(int chose, String choseString)
      Description copied from interface: ICallBack
      Called when a window action is completed.
      Specified by:
      onWindowFinished in interface ICallBack
      Parameters:
      chose - The choice made in the window.
      choseString - The string representation of the choice.