lev.gui

## Class LSaveFile

- java.lang.Object
- - lev.gui.LSaveFile

-     public abstract class LSaveFile
      extends java.lang.Object

  A class that manages importing/exporting of save files, as well as providing methods for LUserSetting GUI components to automatically update tied settings.
  NOTE:
  The in-game parameters currently have no effect at the moment.
  To use it:
  1) Create an enum class defining a name for each setting you want. 2) Extend LSaveFile with your own class that defines its own init functions using the setting enum you created.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.Enum,Setting>` | `cancelSave`
    `protected java.util.Map<java.lang.Enum,Setting>` | `curSettings` Stores the current settings displayed on the GUI.
    `protected java.util.Map<java.lang.Enum,Setting>` | `defaultSettings` Stores the default values for each setting.
    `protected java.util.Map<java.lang.Enum,java.lang.String>` | `helpInfo` Map containing the help text associated with settings in the saveFile.
    `protected boolean` | `initialized`
    `protected java.io.File` | `location`
    `protected java.util.ArrayList<java.util.Map<java.lang.Enum,Setting>>` | `maps` List containing default, save, temp, and current setting maps.
    `protected java.util.Map<java.lang.Enum,Setting>` | `peekSave`
    `protected java.util.Map<java.lang.Enum,Setting>` | `saveSettings` Stores the previously saved settings of the current end user.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LSaveFile(java.io.File location)`
    `LSaveFile(java.lang.String location)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `Add(java.lang.Enum type, java.util.ArrayList<java.lang.String> strs, java.lang.Boolean... extraFlags)` Adds a setting of type integer.
    `void` | `Add(java.lang.Enum type, java.lang.Boolean b, java.lang.Boolean... extraFlags)` Adds a setting of type boolean.
    `void` | `Add(java.lang.Enum type, java.awt.Color c, java.lang.Boolean... extraFlags)` Adds a setting of type Color.
    `void` | `Add(java.lang.Enum type, java.lang.Double d, java.lang.Boolean... extraFlags)` Adds a setting of type double.
    `void` | `Add(java.lang.Enum type, java.lang.Enum e, java.lang.Boolean... extraFlags)` Adds a setting of type enum.
    `void` | `Add(java.lang.Enum type, java.lang.Float f, java.lang.Boolean... extraFlags)` Adds a setting of type float.
    `void` | `Add(java.lang.Enum type, java.lang.Integer i, java.lang.Boolean... extraFlags)` Adds a setting of type integer.
    `void` | `Add(java.lang.Enum type, java.lang.String s, java.lang.Boolean... extraFlags)` Adds a setting of type string.
    `void` | `addString(java.lang.Enum e, java.lang.String s)`
    `boolean` | `checkFlag(java.lang.Enum s, int index)` Checks the flag of given setting at the given index.
    `boolean` | `checkFlagAnd(int index)` Checks the flag of each setting at the given index, and returns the AND logic.
    `boolean` | `checkFlagOr(int index)` Checks the flag of each setting at the given index, and returns the OR logic.
    `void` | `clearPeek()` Clears any "peeked" states, reverts all GUI components to the "current" settings, and clears any highlighting.
    `static void` | `copyTo(java.util.Map<java.lang.Enum,Setting> from, java.util.Map<java.lang.Enum,Setting> to)` Copies one map of settings to another.
    `java.lang.Boolean` | `getBool(java.lang.Enum s)` Returns the value of the setting, and assumes it's a boolean value.
    `java.awt.Color` | `getColor(java.lang.Enum s)`
    `java.util.ArrayList<Setting>` | `getDiff(java.util.Map<java.lang.Enum,Setting> lhs, java.util.Map<java.lang.Enum,Setting> rhs)`
    `java.lang.Enum` | `getEnum(java.lang.Enum s)`
    `float` | `getFloat(java.lang.Enum s)`
    `java.lang.Integer` | `getInt(java.lang.Enum s)` Returns the value of the setting, and assumes it's an int value.
    `java.util.ArrayList<Setting>` | `getModifiedSettings()`
    `java.lang.String` | `getStr(java.lang.Enum s)` Returns the value of the setting, and assumes it's a string value.
    `java.util.ArrayList<java.lang.String>` | `getStrings(java.lang.Enum s)` Returns the value of the setting, and assumes it's a boolean value.
    `void` | `init()` Call this function at the start of your program to signal the savefile to load its settings and prep for use.
    `protected abstract void` | `initHelp()` A function that loads the help map with help text for any settings that you desire.
    `protected abstract void` | `initSettings()` An abstract function that should contain Add() calls that define each setting in the saveFile and their default values.
    `void` | `peekDefaults()` Makes the savefile's GUI ties display default settings, and highlights ones that have changed.
    `void` | `peekSaved()` Makes the savefile's GUI ties display saved settings, and highlights ones that have changed.
    `void` | `removeString(java.lang.Enum e, java.lang.String s)`
    `void` | `revertTo(java.util.Map<java.lang.Enum,Setting> in)` Reverts the current settings to the given map.
    `void` | `revertToCancel()` Reverts the current settings to the backup cancel save
    `void` | `revertToDefault(java.lang.Enum setting)` Reverts the setting to its default state
    `void` | `revertToDefault(LUserSetting s)` Reverts a GUI component to the default setting
    `void` | `revertToSaved(java.lang.Enum setting)` Reverts the setting to its saved state
    `void` | `revertToSaved(LUserSetting s)` Reverts a GUI component to the saved setting
    `void` | `saveToCancelSave()` Saves the current settings to a temporary cancel backup save
    `void` | `saveToFile()` Tells the savefile to write its values to the disk.
    `void` | `setBool(java.lang.Enum e, boolean b)`
    `void` | `setColor(java.lang.Enum e, java.awt.Color c)`
    `void` | `setInt(java.lang.Enum e, int i)`
    `void` | `setStr(java.lang.Enum e, java.lang.String s)`
    `void` | `setStrings(java.lang.Enum e, java.util.ArrayList<java.lang.String> strs)`
    `void` | `tie(java.lang.Enum s, LUserSetting c)` Ties the LUserSetting to the Enum key
    `void` | `updateCurToGUI()` Makes the savefile reacquire the settings from any tied GUI components.
    `void` | `updateCurToGUI(java.lang.Enum s)` Makes the savefile reaquire the settings for the specific enum.
    `void` | `updateGUItoCur()` Reverts the tied GUI to display the current settings.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### location

          protected java.io.File location

    - #### maps

          protected java.util.ArrayList<java.util.Map<java.lang.Enum,Setting>> maps

      List containing default, save, temp, and current setting maps.

    - #### defaultSettings

          protected java.util.Map<java.lang.Enum,Setting> defaultSettings

      Stores the default values for each setting.

    - #### saveSettings

          protected java.util.Map<java.lang.Enum,Setting> saveSettings

      Stores the previously saved settings of the current end user.

    - #### curSettings

          protected java.util.Map<java.lang.Enum,Setting> curSettings

      Stores the current settings displayed on the GUI.

    - #### cancelSave

          protected java.util.Map<java.lang.Enum,Setting> cancelSave

    - #### peekSave

          protected java.util.Map<java.lang.Enum,Setting> peekSave

    - #### helpInfo

          protected java.util.Map<java.lang.Enum,java.lang.String> helpInfo

      Map containing the help text associated with settings in the saveFile.

    - #### initialized

          protected boolean initialized

  - ### Constructor Detail

    - #### LSaveFile

          public LSaveFile(java.io.File location)

      Parameters:
        `location` -

    - #### LSaveFile

          public LSaveFile(java.lang.String location)

      Parameters:
        `location` -

  - ### Method Detail

    - #### tie

          public void tie(java.lang.Enum s,
                 LUserSetting c)

      Ties the LUserSetting to the Enum key
      Parameters:
        `s` - Enum key to tie to
        `c` - Setting to tie with

    - #### init

          public void init()

      Call this function at the start of your program to signal the savefile to load its settings and prep for use.

    - #### initSettings

          protected abstract void initSettings()

      An abstract function that should contain Add() calls that define each setting in the saveFile and their default values.

    - #### initHelp

          protected abstract void initHelp()

      A function that loads the help map with help text for any settings that you desire.

    - #### saveToFile

          public void saveToFile()

      Tells the savefile to write its values to the disk. Should be called as the program is ending.

    - #### Add

          public void Add(java.lang.Enum type,
                 java.lang.Boolean b,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type boolean.
      Parameters:
        `type` - Enum to be associated with.
        `extraFlags` -
        `b` - Default value to assign the setting.

    - #### Add

          public void Add(java.lang.Enum type,
                 java.lang.String s,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type string.
      Parameters:
        `type` - Enum to be associated with.
        `s` - Default value to assign the setting.
        `extraFlags` -

    - #### Add

          public void Add(java.lang.Enum type,
                 java.lang.Integer i,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type integer.
      Parameters:
        `type` - Enum to be associated with.
        `extraFlags` -
        `i` - Default value to assign the setting.

    - #### Add

          public void Add(java.lang.Enum type,
                 java.lang.Enum e,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type enum.
      Parameters:
        `type` - Enum to be associated with.
        `e` -
        `extraFlags` -

    - #### Add

          public void Add(java.lang.Enum type,
                 java.util.ArrayList<java.lang.String> strs,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type integer.
      Parameters:
        `type` - Enum to be associated with.
        `strs` -
        `extraFlags` -

    - #### Add

          public void Add(java.lang.Enum type,
                 java.lang.Float f,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type float.
      Parameters:
        `type` - Enum to be associated with.
        `f` - Default value to assign the setting.
        `extraFlags` -

    - #### Add

          public void Add(java.lang.Enum type,
                 java.awt.Color c,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type Color.
      Parameters:
        `type` - Enum to be associated with.
        `c` -
        `extraFlags` -

    - #### Add

          public void Add(java.lang.Enum type,
                 java.lang.Double d,
                 java.lang.Boolean... extraFlags)

      Adds a setting of type double.
      Parameters:
        `type` - Enum to be associated with.
        `d` - Default value to assign the setting.
        `extraFlags` -

    - #### copyTo

          public static void copyTo(java.util.Map<java.lang.Enum,Setting> from,
                    java.util.Map<java.lang.Enum,Setting> to)

      Copies one map of settings to another. For reverting current settings to default, for example.
      Parameters:
        `from` -
        `to` -

    - #### updateCurToGUI

          public void updateCurToGUI()

      Makes the savefile reacquire the settings from any tied GUI components.

    - #### updateCurToGUI

          public void updateCurToGUI(java.lang.Enum s)

      Makes the savefile reaquire the settings for the specific enum.
      Parameters:
        `s` - Enum to update

    - #### updateGUItoCur

          public void updateGUItoCur()

      Reverts the tied GUI to display the current settings.

    - #### peekSaved

          public void peekSaved()

      Makes the savefile's GUI ties display saved settings, and highlights ones that have changed.

    - #### peekDefaults

          public void peekDefaults()

      Makes the savefile's GUI ties display default settings, and highlights ones that have changed.

    - #### clearPeek

          public void clearPeek()

      Clears any "peeked" states, reverts all GUI components to the "current" settings, and clears any highlighting.

    - #### saveToCancelSave

          public void saveToCancelSave()

      Saves the current settings to a temporary cancel backup save

    - #### revertToCancel

          public void revertToCancel()

      Reverts the current settings to the backup cancel save

    - #### revertTo

          public void revertTo(java.util.Map<java.lang.Enum,Setting> in)

      Reverts the current settings to the given map.
      Parameters:
        `in` -

    - #### revertToSaved

          public void revertToSaved(LUserSetting s)

      Reverts a GUI component to the saved setting
      Parameters:
        `s` -

    - #### revertToDefault

          public void revertToDefault(LUserSetting s)

      Reverts a GUI component to the default setting
      Parameters:
        `s` -

    - #### revertToSaved

          public void revertToSaved(java.lang.Enum setting)

      Reverts the setting to its saved state
      Parameters:
        `setting` -

    - #### revertToDefault

          public void revertToDefault(java.lang.Enum setting)

      Reverts the setting to its default state
      Parameters:
        `setting` -

    - #### checkFlagAnd

          public boolean checkFlagAnd(int index)

      Checks the flag of each setting at the given index, and returns the AND logic.
      Parameters:
        `index` -
      Returns:

    - #### checkFlagOr

          public boolean checkFlagOr(int index)

      Checks the flag of each setting at the given index, and returns the OR logic.
      Parameters:
        `index` -
      Returns:

    - #### checkFlag

          public boolean checkFlag(java.lang.Enum s,
                          int index)

      Checks the flag of given setting at the given index.
      Parameters:
        `s` -
        `index` -
      Returns:

    - #### getModifiedSettings

          public java.util.ArrayList<Setting> getModifiedSettings()

      Returns:

    - #### getDiff

          public java.util.ArrayList<Setting> getDiff(java.util.Map<java.lang.Enum,Setting> lhs,
                                             java.util.Map<java.lang.Enum,Setting> rhs)

      Parameters:
        `lhs` -
        `rhs` -
      Returns:

    - #### getStr

          public java.lang.String getStr(java.lang.Enum s)

      Returns the value of the setting, and assumes it's a string value.
      Parameters:
        `s` -
      Returns:

    - #### getInt

          public java.lang.Integer getInt(java.lang.Enum s)

      Returns the value of the setting, and assumes it's an int value.
      Parameters:
        `s` -
      Returns:

    - #### getBool

          public java.lang.Boolean getBool(java.lang.Enum s)

      Returns the value of the setting, and assumes it's a boolean value.
      Parameters:
        `s` -
      Returns:

    - #### getColor

          public java.awt.Color getColor(java.lang.Enum s)

      Parameters:
        `s` -
      Returns:

    - #### getEnum

          public java.lang.Enum getEnum(java.lang.Enum s)

      Parameters:
        `s` -
      Returns:

    - #### getFloat

          public float getFloat(java.lang.Enum s)

      Parameters:
        `s` -
      Returns:

    - #### getStrings

          public java.util.ArrayList<java.lang.String> getStrings(java.lang.Enum s)

      Returns the value of the setting, and assumes it's a boolean value.
      Parameters:
        `s` -
      Returns:

    - #### setStr

          public void setStr(java.lang.Enum e,
                    java.lang.String s)

      Parameters:
        `e` -
        `s` -

    - #### setInt

          public void setInt(java.lang.Enum e,
                    int i)

      Parameters:
        `e` -
        `i` -

    - #### setColor

          public void setColor(java.lang.Enum e,
                      java.awt.Color c)

      Parameters:
        `e` -
        `c` -

    - #### setBool

          public void setBool(java.lang.Enum e,
                     boolean b)

      Parameters:
        `e` -
        `b` -

    - #### setStrings

          public void setStrings(java.lang.Enum e,
                        java.util.ArrayList<java.lang.String> strs)

      Parameters:
        `e` -
        `strs` -

    - #### addString

          public void addString(java.lang.Enum e,
                       java.lang.String s)

      Parameters:
        `e` -
        `s` -

    - #### removeString

          public void removeString(java.lang.Enum e,
                          java.lang.String s)

      Parameters:
        `e` -
        `s` -