Class TurnoverAndRetentionTab

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

public class TurnoverAndRetentionTab extends Object
The TurnoverAndRetentionTab class represents a graphical user interface (GUI) configuration tab 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 Tab: Controls unit turnover, payouts, and related modifiers.
  • Fatigue Tab: Manages fatigue-related options like kitchen capacity and fatigue rates.
  • Constructor Details

    • TurnoverAndRetentionTab

      public TurnoverAndRetentionTab(CampaignOptions campaignOptions)
      Constructs a TurnoverAndRetentionTab and initializes the tab 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 tab.
  • Method Details

    • createFatigueTab

      public JPanel createFatigueTab()
      Creates and configures the "Fatigue" tab 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 tab.
    • createTurnoverTab

      public JPanel createTurnoverTab()
      Creates and configures the "Turnover" tab 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 tab.
    • 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 tabs. 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.