|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindtree.techworks.insight.preferences.PreferenceManager
public class PreferenceManager
This is a singleton class to be used by the entire application for accessing
and storing Preferences
.
The PreferencesManager is designed not to throw any exceptions, and whenever
a particular exception value is missing or cannot be saved, it will simply
return null
. It is upto the calling method to determine
whether it wants to terminate the usecase or continue with the execution of
the program or display a warning to the user.
Preference
Field Summary |
---|
Fields inherited from interface com.mindtree.techworks.insight.preferences.model.PreferenceModelManager |
---|
OPERATION_CHILD_PREF_ADDED, OPERATION_CHILD_PREF_REMOVED, OPERATION_PREF_ATTR_ADDED, OPERATION_PREF_ATTR_REMOVED |
Method Summary | |
---|---|
void |
applicationShuttingDown()
Method to be called when the application is being shut down. |
void |
attributeValueChanged(java.lang.String completePreferenceId,
java.lang.String attributeId,
java.lang.String newValue)
Notifies all interested parties about change in an Attribute's value. |
void |
childPreferenceChanged(java.lang.String preferenceId,
java.lang.String childPreferenceId,
int operation)
This method is used by the Manager to primarily regenerate the PreferenceInfo for the preference. |
void |
deregisterListener(java.lang.String completePreferenceId,
PreferenceChangeListener listener)
Removes a listener from the list of listeners for a preference, if already registered. |
void |
deregisterListener(java.lang.String completePreferenceId,
java.lang.String attributeId,
PreferenceAttributeChangeListener listener)
Removes a listener from the list of listeners for an attribute, if already registered. |
void |
endPreferencesSave()
Informs this PreferenceManager that the save is complete |
java.util.Collection |
getAllPreferenceNames()
Returns preference info |
java.util.Collection |
getAllPreferences()
Returns all the preferences |
static PreferenceManager |
getInstance()
Returns the singleton instance of PreferenceManager. |
Preference |
getPreference(java.lang.String preferenceId)
Returns a Preference |
void |
preferenceAttributeChanged(java.lang.String preferenceId,
java.lang.String preferenceAttributeId,
int operation)
This method is called on the Preference Model Manager by the Preference, whenever a child preference is added or deleted. |
void |
registerListener(java.lang.String completePreferenceId,
PreferenceChangeListener listener)
Registeres a listener to be notified of changes in preference values. |
void |
registerListener(java.lang.String completePreferenceId,
java.lang.String attributeId,
PreferenceAttributeChangeListener listener)
Registeres a listener to be notified of changes in attribute values. |
void |
startPreferencesSave()
Informs this PreferenceManager of an impending preference(s) save |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static PreferenceManager getInstance()
public Preference getPreference(java.lang.String preferenceId)
preferenceId
- The preferenceId for which the preference is sought
public java.util.Collection getAllPreferenceNames()
PreferenceInfo
objects.public java.util.Collection getAllPreferences()
Collection
of Preferencespublic void registerListener(java.lang.String completePreferenceId, java.lang.String attributeId, PreferenceAttributeChangeListener listener)
completePreferenceId
- The preference the listener is interested inattributeId
- The attribute in the preference the listener is
interested inlistener
- The listener to register. Must implement
PreferenceAttributeChangeListener
public void deregisterListener(java.lang.String completePreferenceId, java.lang.String attributeId, PreferenceAttributeChangeListener listener)
completePreferenceId
- The preference the listener is interested inattributeId
- The attribute in the preference the listener is
interested inlistener
- The listener to register.public void registerListener(java.lang.String completePreferenceId, PreferenceChangeListener listener)
completePreferenceId
- The preference the listener is interested inlistener
- The listener to register. Must implement
PreferenceChangeListener
public void deregisterListener(java.lang.String completePreferenceId, PreferenceChangeListener listener)
completePreferenceId
- The preference the listener is interested inlistener
- The listener to register.public void attributeValueChanged(java.lang.String completePreferenceId, java.lang.String attributeId, java.lang.String newValue)
This method is called by the PreferenceAttribute
whose
value changes. It is used by the PreferenceManager to notify all
interested instances of
PreferenceAttributeChangeListener
instances registered with the PreferenceManager.
This method is also used by the manager to lazy write the preferences. If
a different instance implements
PreferenceModelManager
is used, then the
instance of PreferenceManager should register with that instance for
notifications of all attribute value changes.
attributeValueChanged
in interface PreferenceModelManager
completePreferenceId
- The Preference in which the value changedattributeId
- The Attribute whose value changednewValue
- The new value of the attributePreferenceModelManager.attributeValueChanged(java.lang.String,
java.lang.String, java.lang.String)
public void childPreferenceChanged(java.lang.String preferenceId, java.lang.String childPreferenceId, int operation)
childPreferenceChanged
in interface PreferenceModelManager
preferenceId
- The current Preference id (complete id)childPreferenceId
- The preference id of the child preferenceoperation
- Operation type, denoted by
OPERATION_CHILD_PREF_ADDED
or
OPERATION_CHILD_PREF_REMOVED
PreferenceModelManager.childPreferenceChanged(java.lang.String,
java.lang.String, int)
public void applicationShuttingDown()
public void preferenceAttributeChanged(java.lang.String preferenceId, java.lang.String preferenceAttributeId, int operation)
PreferenceModelManager
preferenceAttributeChanged
in interface PreferenceModelManager
preferenceId
- The current Preference id (complete id)preferenceAttributeId
- The preference id of the child preferenceoperation
- Operation type, denoted by
OPERATION_PREF_ATTR_REMOVED
or
OPERATION_PREF_ATTR_REMOVED
PreferenceModelManager.preferenceAttributeChanged(java.lang.String,
java.lang.String, int)
public void startPreferencesSave()
public void endPreferencesSave()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |