|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdx.scorebot.util.swing.SettingsFile
public class SettingsFile
Stores and retrieves settings to and from a file
Field Summary | |
---|---|
static int |
DEFAULT_MAX_RECENT_FILES
default number recent files |
Constructor Summary | |
---|---|
SettingsFile()
|
Method Summary | |
---|---|
java.lang.Object |
get(java.lang.String key)
gets the value of a particular setting; returns null if there is no setting by this name |
static SettingsFile |
getFromXML()
gets a settings file from XML; uses the default filename settings.xml |
static SettingsFile |
getFromXML(java.lang.String fn)
gets a settings file from XML |
static SettingsFile |
getFromXML(java.lang.String fn,
FileOpener parent,
javax.swing.JMenuItem[] menus)
gets a settings file from XML |
int |
getMaxRecentFiles()
get the max number of recent files to track |
javax.swing.JMenuItem[] |
getMenu()
gets the menus to which recently used menus should be appended |
java.lang.String |
getMostRecentFile()
gets the most recently used file |
java.lang.String |
getMyFilename()
|
FileOpener |
getParent()
gets the parent class which is used to open files when a menu is clicked |
java.util.Vector<java.lang.String> |
getRecentFiles()
returns a list of recently used files |
void |
noteFileUsed(java.lang.String file)
update recent files; file has been used |
void |
populateRecentlyUsedMenus()
Populate the attached menu with the appropriate menus (does nothing if recentlyUsedMenus or parent is set to null). |
void |
remove(java.lang.String key)
removes the value of a particular setting |
void |
set(java.lang.String key,
java.lang.Object value)
sets the value of a particular setting |
void |
setMaxRecentFiles(int maxRecentFiles)
set the max number of recent files to track |
void |
setMenu(javax.swing.JMenuItem[] menus)
sets the menus to which recently used menus should be appended |
void |
setMyFilename(java.lang.String myFilename)
|
void |
setParent(FileOpener parent)
sets the parent class which is used to open files when a menu is clicked |
void |
unnoteFileUsed(java.lang.String file)
update recent files; file is no longer available |
void |
writeToXML()
saves the settings to the current settings file |
void |
writeToXML(java.lang.String fn)
saves the settings to the default settings file (and sets the name to fn) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_RECENT_FILES
Constructor Detail |
---|
public SettingsFile()
Method Detail |
---|
public java.util.Vector<java.lang.String> getRecentFiles()
public int getMaxRecentFiles()
public void setMaxRecentFiles(int maxRecentFiles)
public java.lang.Object get(java.lang.String key)
key
- the name of the setting to get
public void set(java.lang.String key, java.lang.Object value)
key
- the name of the setting to setvalue
- the value of the settingpublic void remove(java.lang.String key)
key
- the name of the setting to setpublic java.lang.String getMostRecentFile()
public void noteFileUsed(java.lang.String file)
file
- path to the file just usedpublic void unnoteFileUsed(java.lang.String file)
file
- path to the file which is no longer availablepublic void populateRecentlyUsedMenus()
public static SettingsFile getFromXML()
public static SettingsFile getFromXML(java.lang.String fn)
fn
- the name of the file the settings are stored in
public static SettingsFile getFromXML(java.lang.String fn, FileOpener parent, javax.swing.JMenuItem[] menus)
fn
- the name of the file the settings are stored inparent
- the GUI which contains these menus and can open filesmenus
- the menus to populate with the recent files list
public void writeToXML()
public void writeToXML(java.lang.String fn)
fn
- the name of the file the settings are stored inpublic javax.swing.JMenuItem[] getMenu()
public void setMenu(javax.swing.JMenuItem[] menus)
public FileOpener getParent()
public void setParent(FileOpener parent)
public java.lang.String getMyFilename()
public void setMyFilename(java.lang.String myFilename)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |