public abstract class LSaveFile
extends java.lang.Object
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 and Description |
---|
LSaveFile(java.io.File location) |
LSaveFile(java.lang.String location) |
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.
|
protected java.io.File location
protected java.util.ArrayList<java.util.Map<java.lang.Enum,Setting>> maps
protected java.util.Map<java.lang.Enum,Setting> defaultSettings
protected java.util.Map<java.lang.Enum,Setting> saveSettings
protected java.util.Map<java.lang.Enum,Setting> curSettings
protected java.util.Map<java.lang.Enum,Setting> cancelSave
protected java.util.Map<java.lang.Enum,Setting> peekSave
protected java.util.Map<java.lang.Enum,java.lang.String> helpInfo
protected boolean initialized
public LSaveFile(java.io.File location)
location
- public LSaveFile(java.lang.String location)
location
- public void tie(java.lang.Enum s, LUserSetting c)
s
- Enum key to tie toc
- Setting to tie withpublic void init()
protected abstract void initSettings()
protected abstract void initHelp()
public void saveToFile()
public void Add(java.lang.Enum type, java.lang.Boolean b, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.extraFlags
- b
- Default value to assign the setting.public void Add(java.lang.Enum type, java.lang.String s, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.s
- Default value to assign the setting.extraFlags
- public void Add(java.lang.Enum type, java.lang.Integer i, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.extraFlags
- i
- Default value to assign the setting.public void Add(java.lang.Enum type, java.lang.Enum e, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.e
- extraFlags
- public void Add(java.lang.Enum type, java.util.ArrayList<java.lang.String> strs, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.strs
- extraFlags
- public void Add(java.lang.Enum type, java.lang.Float f, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.f
- Default value to assign the setting.extraFlags
- public void Add(java.lang.Enum type, java.awt.Color c, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.c
- extraFlags
- public void Add(java.lang.Enum type, java.lang.Double d, java.lang.Boolean... extraFlags)
type
- Enum to be associated with.d
- Default value to assign the setting.extraFlags
- public static void copyTo(java.util.Map<java.lang.Enum,Setting> from, java.util.Map<java.lang.Enum,Setting> to)
from
- to
- public void updateCurToGUI()
public void updateCurToGUI(java.lang.Enum s)
s
- Enum to updatepublic void updateGUItoCur()
public void peekSaved()
public void peekDefaults()
public void clearPeek()
public void saveToCancelSave()
public void revertToCancel()
public void revertTo(java.util.Map<java.lang.Enum,Setting> in)
in
- public void revertToSaved(LUserSetting s)
s
- public void revertToDefault(LUserSetting s)
s
- public void revertToSaved(java.lang.Enum setting)
setting
- public void revertToDefault(java.lang.Enum setting)
setting
- public boolean checkFlagAnd(int index)
index
- public boolean checkFlagOr(int index)
index
- public boolean checkFlag(java.lang.Enum s, int index)
s
- index
- public java.util.ArrayList<Setting> getModifiedSettings()
public java.util.ArrayList<Setting> getDiff(java.util.Map<java.lang.Enum,Setting> lhs, java.util.Map<java.lang.Enum,Setting> rhs)
lhs
- rhs
- public java.lang.String getStr(java.lang.Enum s)
s
- public java.lang.Integer getInt(java.lang.Enum s)
s
- public java.lang.Boolean getBool(java.lang.Enum s)
s
- public java.awt.Color getColor(java.lang.Enum s)
s
- public java.lang.Enum getEnum(java.lang.Enum s)
s
- public float getFloat(java.lang.Enum s)
s
- public java.util.ArrayList<java.lang.String> getStrings(java.lang.Enum s)
s
- public void setStr(java.lang.Enum e, java.lang.String s)
e
- s
- public void setInt(java.lang.Enum e, int i)
e
- i
- public void setColor(java.lang.Enum e, java.awt.Color c)
e
- c
- public void setBool(java.lang.Enum e, boolean b)
e
- b
- public void setStrings(java.lang.Enum e, java.util.ArrayList<java.lang.String> strs)
e
- strs
- public void addString(java.lang.Enum e, java.lang.String s)
e
- s
- public void removeString(java.lang.Enum e, java.lang.String s)
e
- s
-