Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.String,java.util.Set<java.lang.String>> |
category2Choices
maps categories to a set of Strings(representing the choices
which are options for this category).
|
private java.util.HashMap<java.lang.String,java.lang.String> |
category2Default |
private static java.lang.String |
DEFAULTCHOICES_KEY |
private java.util.LinkedList<SettingsListener> |
listenerList |
Constructor and Description |
---|
ChoiceSettings() |
ChoiceSettings(java.util.HashMap<java.lang.String,java.lang.String> category2Default) |
Modifier and Type | Method and Description |
---|---|
void |
addSettingsListener(SettingsListener l)
adds a listener to the settings object
|
private ImmutableSet<Choice> |
choiceMap2choiceSet(java.util.HashMap<java.lang.String,java.lang.String> ccc) |
protected void |
fireSettingsChanged()
sends the message that the state of this setting has been
changed to its registered listeners (not thread-safe)
|
java.util.HashMap<java.lang.String,java.util.Set<java.lang.String>> |
getChoices()
returns a copy of the HashMap that maps categories to
their choices.
|
java.util.HashMap<java.lang.String,java.lang.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(java.lang.Object sender,
java.util.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(java.util.HashMap<java.lang.String,java.lang.String> category2Default) |
void |
updateChoices(Namespace<Choice> 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(java.lang.Object sender,
java.util.Properties props)
implements the method required by the Settings interface.
|
private static final java.lang.String DEFAULTCHOICES_KEY
private java.util.LinkedList<SettingsListener> listenerList
private java.util.HashMap<java.lang.String,java.lang.String> category2Default
private java.util.HashMap<java.lang.String,java.util.Set<java.lang.String>> category2Choices
public ChoiceSettings()
public ChoiceSettings(java.util.HashMap<java.lang.String,java.lang.String> category2Default)
public void setDefaultChoices(java.util.HashMap<java.lang.String,java.lang.String> category2Default)
public java.util.HashMap<java.lang.String,java.util.Set<java.lang.String>> getChoices()
public java.util.HashMap<java.lang.String,java.lang.String> getDefaultChoices()
public ImmutableSet<Choice> getDefaultChoicesAsSet()
private ImmutableSet<Choice> choiceMap2choiceSet(java.util.HashMap<java.lang.String,java.lang.String> ccc)
public void updateChoices(Namespace<Choice> 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(java.lang.Object sender, java.util.Properties props)
readSettings
in interface Settings
public void writeSettings(java.lang.Object sender, java.util.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