public class UserPreferenceManager extends Object
NOTE: MHP implementations are not required to validate the values in Preference objects, even those which are saved using the write method. Applications with write permissions need to be very careful that the values written are valid. Applications reading permissions need to be aware of the possibility that a previous application has set an invalid value.
| Modifier and Type | Method and Description |
|---|---|
void |
addUserPreferenceChangeListener(UserPreferenceChangeListener l)
Adds a listener for changes in user preferences as held in the MHP terminal.
|
static UserPreferenceManager |
getInstance()
Return an instance of the
UserPreferenceManager for this application. |
void |
read(Preference p)
Allows an application to read a specified user preference.
|
void |
read(Preference p,
Facility facility)
Allows an application to read a specified user preference taking
into account the facility defined by the application.
|
void |
removeUserPreferenceChangeListener(UserPreferenceChangeListener l)
Removes a listener for changes in user preferences.
|
void |
write(Preference p)
Saves the specified user preference.
|
public static UserPreferenceManager getInstance()
UserPreferenceManager for this application.
Repeated calls to this method by the same application shall return the
same instance.UserPreferenceManagerpublic void read(Preference p)
Preference object from the MHP
terminal, the ordering of these values shall be as determined by the end-user, from
most preferred to least preferred to the extent that this is known.p - an object representing the preference to read.SecurityException - if the calling application is denied access to this preferencepublic void read(Preference p, Facility facility)
Preference object shall be the values
of that user preference with any unsupported values from the Facility removed from
that list. Note that the order of values returned here need not be the same as that
returned by read(Preference).If the intersection between the two sets of values is empty then the preference will have no value. If there is a mis-match between the name of the preference used when constructing the facility and the name of the preference used in this method then the preference will have no value.
p - an object representing the preference to read.facility - the preferred values of the application for the preferenceSecurityException - if the calling application is denied access to this preferencepublic void write(Preference p) throws UnsupportedPreferenceException, IOException
p - the preference to save.UnsupportedPreferenceException - if the preference provided is not a standardized
preference as defined for use with GeneralPreference.SecurityException - if the application does not have permission to call this methodIOException - if saving the preference fails for other I/O reasonspublic void addUserPreferenceChangeListener(UserPreferenceChangeListener l)
l - the listener to add.public void removeUserPreferenceChangeListener(UserPreferenceChangeListener l)
l - the listener to remove.Copyright © 2012 code4tv.com. All Rights Reserved.