Class TurnoverAndRetentionPages

java.lang.Object
mekhq.gui.campaignOptions.contents.TurnoverAndRetentionPages

public class TurnoverAndRetentionPages extends Object
The TurnoverAndRetentionPages class represents a graphical user interface (GUI) configuration page in the campaign options for managing unit turnover, retention, and fatigue settings.

This class provides functionality to define and customize gameplay-related options such as:

  • Unit turnover settings, including retirement, contract durations, payouts, and modifiers.
  • HR strain and management skills impacting unit cohesion.
  • Fatigue mechanics such as fatigue rates, leave thresholds, and injury fatigue.

The class interacts with a CampaignOptions object, allowing the user to load and save configurations. It consists of two main panels:

  • Turnover Page: Controls unit turnover, payouts, and related modifiers.
  • Fatigue Page: Manages fatigue-related options like kitchen capacity and fatigue rates.
  • Constructor Details

    • TurnoverAndRetentionPages

      public TurnoverAndRetentionPages(@Nonnull CampaignOptions campaignOptions)
      Constructs a TurnoverAndRetentionPages and initializes the page with the given CampaignOptions. This sets up necessary UI components and their default configurations.
      Parameters:
      campaignOptions - the CampaignOptions instance that holds the settings to be modified or displayed in this page.
  • Method Details

    • createFatiguePage

      @Nonnull public JPanel createFatiguePage()
      Creates and configures the "Fatigue" page with its relevant components. These include options related to enabling fatigue, fatigue rates, injury fatigue, kitchen capacities, and leave thresholds.
      Returns:
      the JPanel representing the constructed Fatigue page.
    • createTurnoverPage

      @Nonnull public JPanel createTurnoverPage()
      Creates and configures the "Turnover" page with its relevant components. These include options for turnover control, random retirement, payout settings, and modifiers for HR Strain and cohesion.
      Returns:
      the JPanel representing the constructed Turnover page.
    • loadValuesFromCampaignOptions

      public void loadValuesFromCampaignOptions()
      Overload of loadValuesFromCampaignOptions method. Loads values from the current CampaignOptions instance.
    • loadValuesFromCampaignOptions

      public void loadValuesFromCampaignOptions(@Nullable CampaignOptions presetCampaignOptions)
      Loads the current configuration values from the provided CampaignOptions object and updates the associated UI components in both the Turnover and Fatigue pages. If no options are provided, the existing campaign options are used.
      Parameters:
      presetCampaignOptions - the CampaignOptions instance to load settings from, or null to use the current campaign options.
    • applyCampaignOptionsToCampaign

      public void applyCampaignOptionsToCampaign(@Nullable CampaignOptions presetCampaignOptions)
      Applies the current campaign options based on the configurations in the UI to the given CampaignOptions. If no options are provided, the current campaign options are updated.
      Parameters:
      presetCampaignOptions - the CampaignOptions instance to save settings to, or null to update the current campaign options.