public class PreferencesWriter
extends Object
Modifier and Type | Field and Description |
---|---|
(package private) ActorsPrefPanel |
actors |
(package private) AppearancePrefPanel |
appearance |
(package private) CompatibilityPrefPanel |
compat |
(package private) ConfigurationPrefPanel |
configPanel |
Constructor and Description |
---|
PreferencesWriter(AppearancePrefPanel appearance,
CompatibilityPrefPanel compat,
ActorsPrefPanel actors,
ConfigurationPrefPanel configPanel) |
Modifier and Type | Method and Description |
---|---|
protected String |
booleanPrefToString(String name,
boolean value,
String help)
Format the given setting as a string, for output to the preferences file.
|
String |
colorPrefToString(String classname,
String foreback)
Given a class name and whether text or fill, creates the preferences file
entry for it.
|
protected String |
doublePrefToString(String name,
double value,
String help)
Format the given setting as a string, for output to the preferences file.
|
String |
fileToString(String filename)
Handles occurrence of backslash in Windows filenames, replacing them with
forward slashes in writing.
|
protected String |
floatPrefToString(String name,
float value,
String help)
Format the given setting as a string, for output to the preferences file.
|
protected String |
intPrefToString(String name,
int value,
String help)
Format the given setting as a string, for output to the preferences file.
|
protected String |
prefsToString()
When creating a new Preference, the following places need to be changed:
the Preferences class (and window) need to have some sort of
control for the preference charger.Global (or other appropriate
class) needs to have a "global" with the preference current value (and
default value) getPrefsAsString needs to have an entry for the
preference methods need to be provided in this class to handle
changes to the Hub's value
|
void |
savePreferences(String prefsFilename)
Saves the global preferences to the global preference file.
|
protected String |
StringPrefToString(String name,
String value,
String help)
Format the given setting as a string, for output to the preferences file.
|
String |
textAndFillDefaultToString(String classname)
Given a class name, return two text lines conveying the class's default
color scheme suitable for writing to a preferences file.
|
AppearancePrefPanel appearance
CompatibilityPrefPanel compat
ActorsPrefPanel actors
ConfigurationPrefPanel configPanel
public PreferencesWriter(AppearancePrefPanel appearance, CompatibilityPrefPanel compat, ActorsPrefPanel actors, ConfigurationPrefPanel configPanel)
protected String intPrefToString(String name, int value, String help)
name
- the key in the Prefs property listvalue
- an integer valuehelp
- a descriptive string (e.g., one obtained from a tool tip)protected String floatPrefToString(String name, float value, String help)
name
- the key in the Prefs property listvalue
- a float valuehelp
- a descriptive string (e.g., one obtained from a tool tip)protected String doublePrefToString(String name, double value, String help)
name
- the key in the Prefs property listvalue
- a double valuehelp
- a descriptive string (e.g., one obtained from a tool tip)protected String StringPrefToString(String name, String value, String help)
name
- the key in the Prefs property listvalue
- a string valuehelp
- a descriptive string (e.g., one obtained from a tool tip)protected String booleanPrefToString(String name, boolean value, String help)
name
- the key in the Prefs property listvalue
- a boolean valuehelp
- a descriptive string (e.g., one obtained from a tool tip)public String textAndFillDefaultToString(String classname)
classname
- the (unqualified) class name (i.e., without package
info)public String fileToString(String filename)
filename
- public String colorPrefToString(String classname, String foreback)
defaultColor-classname-<text|fill<=R,G,B
defaultColor-Concept-text=255,255,255
public void savePreferences(String prefsFilename) throws CGFileException
prefsFilename
- CGFileException
protected String prefsToString()