Interface ProfileStateParticipant


public interface ProfileStateParticipant
Interface for panels that participate in profile save/load.

Implement this on any settings panel to enable profile management. When a profile is saved, putStateInto(Map) is called on every participating panel. When loaded, loadStateFrom(Map) restores the state.

Usage:


 class GeneralSettingsPanel extends JPanel implements ProfileStateParticipant {
     private JTextField npcIdsField;
     private JTextField lootNamesField;

     @Override
     public void putStateInto(Map<String, Object> map) {
         map.put("npcIds", npcIdsField.getText());
         map.put("lootNames", lootNamesField.getText());
     }

     @Override
     public void loadStateFrom(Map<String, Object> map) {
         npcIdsField.setText((String) map.getOrDefault("npcIds", ""));
         lootNamesField.setText((String) map.getOrDefault("lootNames", ""));
     }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Restores the panel's state from a previously saved profile map.
    void
    Saves the panel's current state into the profile map.
  • Method Details

    • putStateInto

      void putStateInto(Map<String,Object> map)
      Saves the panel's current state into the profile map. Keys should be stable identifiers (not display names).
      Parameters:
      map - the profile map to write state into
    • loadStateFrom

      void loadStateFrom(Map<String,Object> map)
      Restores the panel's state from a previously saved profile map. Implementations should handle missing keys gracefully (use defaults).
      Parameters:
      map - the profile map to read state from