Modifier and Type | Field and Description |
---|---|
private HashMap<String,Set<String>> |
category2Choices
maps categories to a set of Strings(representing the choices
which are options for this category).
|
private HashMap<String,String> |
category2Default |
private static String |
DEFAULTCHOICES_KEY |
private LinkedList<SettingsListener> |
listenerList |
Constructor and Description |
---|
ChoiceSettings() |
ChoiceSettings(HashMap<String,String> category2Default) |
Modifier and Type | Method and Description |
---|---|
void |
addSettingsListener(SettingsListener l)
adds a listener to the settings object
|
private ImmutableSet<Choice> |
choiceMap2choiceSet(HashMap<String,String> ccc) |
protected void |
fireSettingsChanged()
sends the message that the state of this setting has been
changed to its registered listeners (not thread-safe)
|
HashMap<String,Set<String>> |
getChoices()
returns a copy of the HashMap that maps categories to
their choices.
|
HashMap<String,String> |
getDefaultChoices()
returns a copy of the HashMap that maps categories to
their default choices.
|
ImmutableSet<Choice> |
getDefaultChoicesAsSet()
returns the current selected choices as set
|
void |
readSettings(Object sender,
Properties props)
gets a Properties object and has to perform the necessary
steps in order to change this object in a way that it
represents the stored settings
|
void |
setDefaultChoices(HashMap<String,String> category2Default) |
void |
updateChoices(Namespace choiceNS,
boolean remove)
updates
category2Choices if new entries are found
in choiceNS or if entries of category2Choices
are no longer present in choiceNS |
ChoiceSettings |
updateWith(ImmutableSet<Choice> sc) |
void |
writeSettings(Object sender,
Properties props)
implements the method required by the Settings interface.
|
private static final String DEFAULTCHOICES_KEY
private LinkedList<SettingsListener> listenerList
public HashMap<String,Set<String>> getChoices()
public HashMap<String,String> getDefaultChoices()
public ImmutableSet<Choice> getDefaultChoicesAsSet()
private ImmutableSet<Choice> choiceMap2choiceSet(HashMap<String,String> ccc)
public void updateChoices(Namespace choiceNS, boolean remove)
category2Choices
if new entries are found
in choiceNS
or if entries of category2Choices
are no longer present in choiceNS
remove
- remove entries not present in choiceNS
protected void fireSettingsChanged()
public void readSettings(Object sender, Properties props)
readSettings
in interface Settings
public void writeSettings(Object sender, Properties props)
writeSettings
in interface Settings
props
- the Properties object where to write the
settings as (key, value) pairpublic ChoiceSettings updateWith(ImmutableSet<Choice> sc)
public void addSettingsListener(SettingsListener l)
addSettingsListener
in interface Settings
l
- the listener