|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.config.Config
public class Config
Config is the core part of the configuration system; it is simply a
Collection of Choice
s.
Config does the following things:
The GNU Lesser General Public License for details.
Field Summary | |
---|---|
protected PropertyChangeSupport |
changeListeners
The set of property change listeners. |
protected List<String> |
keys
The array that stores the keys |
protected List<ConfigListener> |
listeners
The list of listeners |
protected PropertyMap |
local
The set of local values |
private static org.slf4j.Logger |
LOGGER
The log stream |
protected List<Choice> |
models
The array that stores the models |
protected String |
title
The name for dialog boxes and properties files |
Constructor Summary | |
---|---|
Config(String title)
Config ctor |
Method Summary | |
---|---|
void |
add(Choice model)
Add a key/model pairing |
void |
add(org.jdom2.Document xmlconfig,
ResourceBundle configResources)
Add the set of configuration options specified in the xml file. |
void |
addConfigListener(ConfigListener li)
Add an Exception listener to the list of things wanting to know whenever we capture an Exception. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
void |
applicationToLocal()
Take the data in the application and copy it to the local storage area. |
protected void |
fireChoiceAdded(String key,
Choice model)
A Choice got added. |
protected void |
fireChoiceRemoved(String key,
Choice model)
A Choice got removed. |
Choice |
getChoice(String key)
Get the Choice for a given key |
static String |
getLeaf(String key)
What is the last part of the Path of this key. |
String |
getLocal(String name)
Get a configuration Choice (by name). |
static String |
getPath(String key)
What is the Path of this key |
PropertyMap |
getProperties()
Take the data in the local storage area and store it permanently. |
String |
getTitle()
The name for the dialog boxes and properties files. |
Iterator<Choice> |
iterator()
The set of Choice that we are controlling |
void |
localToApplication()
Take the data in the local storage area and copy it to the application. |
void |
localToPermanent(URI uri)
Take the data in the local storage area and store it permanently, using the configured storage area. |
void |
permanentToLocal(URI uri)
Take the data stored permanently and copy it to the local storage area, using the configured storage area |
void |
remove(String key)
Remove a key/model pairing |
void |
removeConfigListener(ConfigListener li)
Remove an Exception listener from the list of things wanting to know whenever we capture an Exception |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
setLocal(String name,
String value)
Set a configuration Choice (by name) to a new value. |
void |
setProperties(PropertyMap prop)
Take the data stored permanently and copy it to the local storage area, using the specified stream. |
int |
size()
The number of Choices |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String title
protected List<String> keys
protected List<Choice> models
protected PropertyMap local
protected PropertyChangeSupport changeListeners
protected List<ConfigListener> listeners
private static final org.slf4j.Logger LOGGER
Constructor Detail |
---|
public Config(String title)
title
- The name for dialog boxes and properties filesMethod Detail |
---|
public String getTitle()
public void add(Choice model)
model
- The Choice model to map to its keypublic void add(org.jdom2.Document xmlconfig, ResourceBundle configResources)
xmlconfig
- The JDOM document to read.configResources
- contains the user level text for this configpublic void remove(String key)
key
- The name to killpublic Iterator<Choice> iterator()
iterator
in interface Iterable<Choice>
public Choice getChoice(String key)
key
- the key for the choice
public int size()
public void setLocal(String name, String value)
name
- the key for the choicevalue
- the value for the choicepublic String getLocal(String name)
name
- the key for the choice
public void applicationToLocal()
public void localToApplication()
public void setProperties(PropertyMap prop)
prop
- the set of properties to savepublic PropertyMap getProperties()
public void permanentToLocal(URI uri) throws IOException
uri
- the location of the permanent storage
IOException
- if there was a problem getting the permanent config infopublic void localToPermanent(URI uri) throws IOException
uri
- the location of the permanent storage
IOException
- if there was a problem storing the permanent config infopublic static String getPath(String key)
key
- the key of the property
public static String getLeaf(String key)
key
- the key of the property
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be removedpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be addedpublic void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removedpublic void addConfigListener(ConfigListener li)
li
- The ConfigListener to be addedpublic void removeConfigListener(ConfigListener li)
li
- The ConfigListener to be removedprotected void fireChoiceAdded(String key, Choice model)
key
- the key of the choice that has been addedmodel
- the choice that was addedprotected void fireChoiceRemoved(String key, Choice model)
key
- the key of the choice that has been removedmodel
- the choice that was removed
|
Copyright ยจ 2003-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |