Class CardSelectScreen

java.lang.Object
javatro.display.screens.Screen
javatro.display.screens.CardSelectScreen
Direct Known Subclasses:
DiscardCardScreen, PlayCardScreen

public abstract class CardSelectScreen extends Screen
Abstract base class for card selection screens with sorting and display capabilities.

Provides common functionality for:

  • Displaying formatted card hands
  • Handling card sorting operations
  • Managing selection options
  • Maintaining card display state
  • Constructor Details

    • CardSelectScreen

      public CardSelectScreen(String optionsTitle) throws JavatroException
      Constructs a card selection screen with core functionality.
      Parameters:
      optionsTitle - Title for the options section
      Throws:
      JavatroException - if optionsTitle is invalid
  • Method Details

    • updateHoldingHand

      public void updateHoldingHand(CardSelectScreen.SortOrder sortOrder)
      Updates and sorts the displayed hand according to specified order.
      Parameters:
      sortOrder - Desired sorting order (null preserves current order)
    • getCardIndicesTitle

      protected String getCardIndicesTitle(int cardCount)
      Generates formatted card index header for display.
      Parameters:
      cardCount - Number of cards in hand
      Returns:
      Formatted string with numbered card positions
    • displayHoldingHand

      public void displayHoldingHand()
      Displays formatted card hand with borders and styling.
    • displayScreen

      public abstract void displayScreen()
      Implemented by subclasses to define screen-specific display logic
      Specified by:
      displayScreen in class Screen