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 TypeMethodDescriptionvoidloadStateFrom(Map<String, Object> map) Restores the panel's state from a previously saved profile map.voidputStateInto(Map<String, Object> map) Saves the panel's current state into the profile map.
-
Method Details
-
putStateInto
-
loadStateFrom
-