Class Screen

java.lang.Object
javatro.display.screens.Screen
Direct Known Subclasses:
BlindSelectScreen, CardSelectScreen, DeckSelectScreen, DeckViewScreen, GameScreen, HelpScreen, LoseScreen, PokerHandScreen, RunListScreen, RunSelectScreen, StartScreen, WinGameScreen, WinRoundScreen

public abstract class Screen extends Object
Abstract base class representing a display screen in the Javatro application.

Provides common functionality for:

  • Managing screen options/commands
  • Displaying formatted menus
  • Handling user command selection

Subclasses must implement displayScreen() to define specific screen content.

  • Field Details

    • commandMap

      protected final List<Option> commandMap
      List of available commands/options for this screen
  • Constructor Details

    • Screen

      public Screen(String optionsTitle) throws JavatroException
      Constructs a screen with specified options menu title.
      Parameters:
      optionsTitle - Descriptive title for the options section (1-3 words recommended)
      Throws:
      JavatroException - if optionsTitle is null or empty
  • Method Details

    • displayScreen

      public abstract void displayScreen()
      Displays the main content of the screen.

      Must be implemented by concrete subclasses to define:

      • Screen-specific header/content
      • Any additional visual elements
      • Dynamic content updates
    • displayOptions

      public void displayOptions()
      Displays formatted options menu with title and border decoration.

      Output includes:

      • Styled title header
      • Numbered list of options
      • Option descriptions with consistent formatting
      • Visual border elements
    • getCommandMap

      public List<Option> getCommandMap()
    • clearCommandMap

      public void clearCommandMap()
    • getOptionsSize

      public int getOptionsSize()
      Gets the current number of available options.
      Returns:
      Number of registered commands/options (always ≥ 0)
    • getCommand

      public Option getCommand(int index) throws JavatroException
      Retrieves a command by its index position.
      Parameters:
      index - Zero-based index of the command
      Returns:
      Selected Option object
      Throws:
      JavatroException - if index is out of valid range
    • getOutput

      public void getOutput()