Class JmriUserPreferencesManager
- All Implemented Interfaces:
BeanInterface,PropertyChangeFirer,PropertyChangeProvider,InstanceManagerAutoInitialize,UserPreferencesManager
UserPreferencesManager that saves user interface
preferences that should be automatically remembered as they are set.
This class is intended to be a transitional class from a single user interface preferences manager to multiple, domain-specific (windows, tables, dialogs, etc) user interface preferences managers. Domain-specific managers can more efficiently, both in the API and at runtime, handle each user interface preference need than a single monolithic manager.
The following items are available. Each item has its own section in the user-interface.xml file.
- Class Preferences
- This contains reminders and selections from dialogs displayed to users. These are normally
related to the JMRI NamedBeans represented by the various PanelPro tables. The
responses are shown in Preferences -> Messages. This provides the ability to
revert previous choices. See
UserMessagePreferencesPaneThe dialogs are invoked by the various show<Info|Warning|Error>Message dialogs. There are two types of messages created by the dialogs.
- multipleChoice
- The multiple choice message has a keyword and the selected option. It only exists when the selected option index is greater than zero.
- reminderPrompts
- The reminder prompt message has a keyword, such as remindSaveRoute. It only exists when the reminder is active.
When the Skip message in future? or Remember this setting for next time? is selected, an entry will be added. The
setClassDescription(String)method will use Java reflection to request additional information from the class that was used to the show dialog. This requires some specific changes to the originating class.- Class Constructor
- A constructor without parameters is required. This is used to get the class so that the following public methods can be invoked.
- getClassDescription()
- This returns a string that will be used by Preferences -> Messages.
- setMessagePreferenceDetails()
- This does not return anything directly. It makes call backs using two methods.
setMessageItemDetails(String, String, String, HashMap, int)- Descriptive information, the items for a combo box and the current selection are sent. This information is used to create the multipleChoice item.
setPreferenceItemDetails(String, String, String)- Descriptive information is sent to create the reminderPrompt item.
The messages are normally created by the various NamedBean classes. LogixNG uses a separate class instead of changing each affected class. This provides a concise example of the required changes at LogixNG_UserPreferences
- Checkbox State
- Contains the last checkbox state.
Methods: - Combobox Selection
- Contains the last combo box selection.
Methods: - Settings
- The existence of an entry indicates a true state.
Methods: - Window Details
- The main data is the window location and size. This is handled by
JmriJFrame. The window details can also include window specific properties.
Methods:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classHolds details about the specific class.static classprotected static final classprotected static final classprotected static final class -
Field Summary
FieldsFields inherited from class jmri.beans.Bean
propertyChangeSupportFields inherited from interface jmri.UserPreferencesManager
PREFERENCES_UPDATED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbooleanbooleangetCheckboxPreferenceState(String name, boolean defaultState) Enquire as to the state of a user preference.getChoiceDescription(String strClass, String item) Get the a meaningful description of a given item in a given class or group.getChoiceName(String strClass, int n) Get the nth item name in a given class.getChoiceOptions(String strClass, String item) Returns a map of the value against description of the different items in a given class.getClassDescription(String strClass) Get the description of a class/group registered with the preferences.protected final Stringprotected final JmriUserPreferencesManager.ClassPreferencesgetClassPreferences(String strClass) getComboBoxLastSelection(String comboBoxName) The last selected value in a given combo box.intgetMultipleChoiceDefaultOption(String strClass, String choice) Returns the default value of a given item in a given classgetMultipleChoiceList(String strClass) Get a list of all the multiple choice items registered with a given class.intgetMultipleChoiceOption(String strClass, String item) Get the current value of a given item in a given class.intgetMultipleChoiceSize(String strClass) Get the number of Multiple Choice items registered with a given class.getPreferenceItemDescription(String strClass, String item) Returns the description of the given item preference in the given classgetPreferenceItemName(String strClass, int n) Returns the itemName of the n preference in the given classgetPreferenceList(String strClass) Returns a list of preferences that are registered against a specific class.Get the list of the classes registered with the preference manager.intgetPreferencesSize(String strClass) Get the combined size of both types of items registered.booleangetPreferenceState(String strClass, String item) Returns the state of a given item registered against a specific class or item.getProperty(String strClass, String key) Retrieve the value associated with a key in a given class If no value has been set for that key, returns null.getPropertyKeys(String strClass) Retrieve the complete current set of keys for a given class.booleangetSaveWindowLocation(String strClass) booleangetSaveWindowSize(String strClass) booleanEnquire as to the state of a user preference for the current session.booleanEnquire as to the state of a user preference.Returns an ArrayList of the check box states set as true.getWindowLocation(String strClass) Get the x,y location of a given Window.getWindowSize(String strClass) Returns the width, height size of a given WindowbooleanhasProperties(String strClass) Check if there are properties for the given classvoidPerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.protected booleanCheck if this object is loading preferences from storage.booleanCheck if saving preferences is allowed.final voidvoidprotected voidsaveElement(org.jdom2.Element element) voidsetChangeMade(boolean fireUpdate) voidsetCheckboxPreferenceState(String name, boolean state) This is used to remember the last selected state of a checkBox and thus allow that checkBox to be set to a true state when it is next initialized.voidsetClassDescription(String strClass) Given that we know the class as a string, we will try and attempt to gather details about the preferences that has been added, so that we can make better sense of the details in the preferences window.voidsetComboBoxLastSelection(String comboBoxName, String lastValue) Set the last selected value in a given combo box.voidvoidsetMessageItemDetails(String strClass, String item, String description, HashMap<Integer, String> options, int defaultOption) Add descriptive details about a specific message box, so that if it needs to be reset in the preferences, then it is easily identifiable. displayed to the user in the preferences GUI.voidsetMultipleChoiceOption(String strClass, String choice, int value) Sets the value of a given item in a given class, by its integer value.voidsetMultipleChoiceOption(String strClass, String choice, String value) Sets the value of a given item in a given class, by its string description.final voidsetPreferenceItemDetails(String strClass, String item, String description) Register details about a particular preference, so that it can be displayed in the GUI and provide a meaning full description when presented to the user.voidsetPreferenceState(String strClass, String item, boolean state) Used to save the state of checkboxes which can suppress messages from being displayed.voidsetProperty(String strClass, String key, Object value) Attach a key/value pair to the given class, which can be retrieved later.voidsetSaveAllowed(boolean saveAllowed) Set if saving preferences is allowed.voidsetSaveWindowLocation(String strClass, boolean b) Set if window locations should be saved for a given class.voidsetSaveWindowSize(String strClass, boolean b) Set if window sizes should be saved for a given class.voidsetSessionPreferenceState(String name, boolean state) Used to surpress messages for a particular session, the information is not stored, can not be changed via the GUI.voidsetSimplePreferenceState(String name, boolean state) This is used to remember the last selected state of a checkBox and thus allow that checkBox to be set to a true state when it is next initialized.voidsetWindowLocation(String strClass, Point location) Saves the last location of a given component on the screen.voidsetWindowSize(String strClass, Dimension dim) Saves the last size of a given component on the screenvoidshowErrorMessage(Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an error message ("don't forget ...") with a given dialog title and user message.voidshowErrorMessage(String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an error message ("don't forget ...") with a given dialog title and user message.voidshowInfoMessage(Component parentComponent, String title, String message, String strClass, String item) Show an info message ("don't forget ...") with a given dialog title and user message.voidshowInfoMessage(Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an info message ("don't forget ...") with a given dialog title and user message.voidshowInfoMessage(String title, String message, String strClass, String item) Show an info message ("don't forget ...") with a given dialog title and user message.voidshowInfoMessage(String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an info message ("don't forget ...") with a given dialog title and user message.protected voidshowMessage(Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember, int type) voidshowWarningMessage(Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show a warning message ("don't forget ...") with a given dialog title and user message.voidshowWarningMessage(String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show a warning message ("don't forget ...") with a given dialog title and user message.Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setPropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.UserPreferencesManager
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
SAVE_ALLOWED
- See Also:
-
comboBoxLastSelection
-
checkBoxLastSelection
-
-
Constructor Details
-
JmriUserPreferencesManager
public JmriUserPreferencesManager()
-
-
Method Details
-
setSaveAllowed
Description copied from interface:UserPreferencesManagerSet if saving preferences is allowed. When setting true, preferences will be saved immediately if needed.Note only set false if a number of preferences will be set together to avoid excessive disk I/O while setting preferences.
Note remember to allow saving as soon as blocking saving is no longer needed.
- Specified by:
setSaveAllowedin interfaceUserPreferencesManager- Parameters:
saveAllowed- true to allow saving; false to block saving
-
isSaveAllowed
Description copied from interface:UserPreferencesManagerCheck if saving preferences is allowed.- Specified by:
isSaveAllowedin interfaceUserPreferencesManager- Returns:
- true if saving is allowed; false otherwise
-
getScreen
- Specified by:
getScreenin interfaceUserPreferencesManager
-
setSimplePreferenceState
This is used to remember the last selected state of a checkBox and thus allow that checkBox to be set to a true state when it is next initialized. This can also be used anywhere else that a simple yes/no, true/false type preference needs to be stored.It should not be used for remembering if a user wants to suppress a message as there is no means in the GUI for the user to reset the flag. setPreferenceState() should be used in this instance The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class.
- Specified by:
setSimplePreferenceStatein interfaceUserPreferencesManager- Parameters:
name- A unique name to identify the state being storedstate- simple boolean.
-
getSimplePreferenceState
Description copied from interface:UserPreferencesManagerEnquire as to the state of a user preference.Preferences that have not been set will be considered to be false.
The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class.
- Specified by:
getSimplePreferenceStatein interfaceUserPreferencesManager- Parameters:
name- the name of the preference- Returns:
- the state or false if never set
-
getSimplePreferenceStateList
Description copied from interface:UserPreferencesManagerReturns an ArrayList of the check box states set as true.- Specified by:
getSimplePreferenceStateListin interfaceUserPreferencesManager- Returns:
- list of simple preferences names
-
setPreferenceState
Description copied from interface:UserPreferencesManagerUsed to save the state of checkboxes which can suppress messages from being displayed. This method should be used by the initiating code in conjunction with the preferenceItemDetails. Here the items are stored against a specific class and access to change them is made available via the GUI, in the preference manager.The strClass parameter does not have to be the exact class name of the initiating code, but can be one where the information is related and therefore can be grouped together with.
Both the strClass and item although free form, should make up a unique reference.
- Specified by:
setPreferenceStatein interfaceUserPreferencesManager- Parameters:
strClass- The class that this preference should be stored or grouped with.item- The specific item that is to be storedstate- Boolean state of the item.
-
getPreferenceState
Description copied from interface:UserPreferencesManagerReturns the state of a given item registered against a specific class or item.- Specified by:
getPreferenceStatein interfaceUserPreferencesManager- Parameters:
strClass- name of the class for this preferenceitem- name of the item for which the state is being retrieved- Returns:
- the state or false if not set
-
setPreferenceItemDetails
Description copied from interface:UserPreferencesManagerRegister details about a particular preference, so that it can be displayed in the GUI and provide a meaning full description when presented to the user.- Specified by:
setPreferenceItemDetailsin interfaceUserPreferencesManager- Parameters:
strClass- A string form of the class that the preference is stored or grouped withitem- The specific item that is being storeddescription- A meaningful description of the item that the user will understand
-
getPreferenceList
Description copied from interface:UserPreferencesManagerReturns a list of preferences that are registered against a specific class.- Specified by:
getPreferenceListin interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- the list of preference names
-
getPreferenceItemName
Description copied from interface:UserPreferencesManagerReturns the itemName of the n preference in the given class- Specified by:
getPreferenceItemNamein interfaceUserPreferencesManager- Parameters:
strClass- the name of the classn- the position in an array- Returns:
- the name of the preference or null if non-existent
-
getPreferenceItemDescription
Description copied from interface:UserPreferencesManagerReturns the description of the given item preference in the given class- Specified by:
getPreferenceItemDescriptionin interfaceUserPreferencesManager- Parameters:
strClass- the name of the classitem- the name of the item- Returns:
- the description of the preference
-
setSessionPreferenceState
Used to surpress messages for a particular session, the information is not stored, can not be changed via the GUI.This can be used to help prevent over loading the user with repetitive error messages such as turnout not found while loading a panel file due to a connection failing. The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class.
- Specified by:
setSessionPreferenceStatein interfaceUserPreferencesManager- Parameters:
name- A unique identifier for preference.state- suppression state of the item.
-
getSessionPreferenceState
Enquire as to the state of a user preference for the current session.Preferences that have not been set will be considered to be false.
The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class.
- Specified by:
getSessionPreferenceStatein interfaceUserPreferencesManager- Parameters:
name- the name of the preference- Returns:
- the state or false if not set
-
showInfoMessage
Show an info message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. The combination of the classString and item parameters should form a unique value.- Specified by:
showInfoMessagein interfaceUserPreferencesManager- Parameters:
title- message Box titlemessage- message to be displayedstrClass- name of the calling classitem- name of the specific item this is used for
-
showInfoMessage
public void showInfoMessage(@CheckForNull Component parentComponent, String title, String message, String strClass, String item) Show an info message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. The combination of the classString and item parameters should form a unique value.- Specified by:
showInfoMessagein interfaceUserPreferencesManager- Parameters:
parentComponent- Used to improve Dialog display, can be null.title- message Box titlemessage- message to be displayedstrClass- name of the calling classitem- name of the specific item this is used for
-
showErrorMessage
public void showErrorMessage(String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an error message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. added flag to indicate that the message should be suppressed JMRI session only. The classString and item parameters should form a unique value- Specified by:
showErrorMessagein interfaceUserPreferencesManager- Parameters:
title- Message Box titlemessage- Message to be displayedstrClass- String value of the calling classitem- String value of the specific item this is used forsessionOnly- Means this message will be suppressed in this JMRI session and not be rememberedalwaysRemember- Means that the suppression of the message will be saved
-
showErrorMessage
public void showErrorMessage(@CheckForNull Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an error message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. Flag to indicate that the message should be suppressed JMRI session only. The classString and item parameters should form a unique value.- Specified by:
showErrorMessagein interfaceUserPreferencesManager- Parameters:
parentComponent- Used to improve Dialog display, can be null.title- Message Box titlemessage- Message to be displayedstrClass- String value of the calling classitem- String value of the specific item this is used forsessionOnly- Means this message will be suppressed in this JMRI session and not be rememberedalwaysRemember- Means that the suppression of the message will be saved
-
showInfoMessage
public void showInfoMessage(String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an info message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. added flag to indicate that the message should be suppressed JMRI session only. The classString and item parameters should form a unique value- Specified by:
showInfoMessagein interfaceUserPreferencesManager- Parameters:
title- Message Box titlemessage- Message to be displayedstrClass- String value of the calling classitem- String value of the specific item this is used forsessionOnly- Means this message will be suppressed in this JMRI session and not be rememberedalwaysRemember- Means that the suppression of the message will be saved
-
showInfoMessage
public void showInfoMessage(@CheckForNull Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show an info message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. Flag to indicate that the message should be suppressed JMRI session only. The classString and item parameters should form a unique value.- Specified by:
showInfoMessagein interfaceUserPreferencesManager- Parameters:
parentComponent- Used to improve Dialog display, can be null.title- Message Box titlemessage- Message to be displayedstrClass- String value of the calling classitem- String value of the specific item this is used forsessionOnly- Means this message will be suppressed in this JMRI session and not be rememberedalwaysRemember- Means that the suppression of the message will be saved
-
showWarningMessage
public void showWarningMessage(String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show a warning message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. added flag to indicate that the message should be suppressed JMRI session only. The classString and item parameters should form a unique value- Specified by:
showWarningMessagein interfaceUserPreferencesManager- Parameters:
title- Message Box titlemessage- Message to be displayedstrClass- String value of the calling classitem- String value of the specific item this is used forsessionOnly- Means this message will be suppressed in this JMRI session and not be rememberedalwaysRemember- Means that the suppression of the message will be saved
-
showWarningMessage
public void showWarningMessage(@CheckForNull Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember) Show a warning message ("don't forget ...") with a given dialog title and user message. Use a given preference name to determine whether to show it in the future. Flag to indicate that the message should be suppressed JMRI session only. The classString and item parameters should form a unique value.- Specified by:
showWarningMessagein interfaceUserPreferencesManager- Parameters:
parentComponent- Used to improve Dialog display, can be null.title- Message Box titlemessage- Message to be displayedstrClass- String value of the calling classitem- String value of the specific item this is used forsessionOnly- Means this message will be suppressed in this JMRI session and not be rememberedalwaysRemember- Means that the suppression of the message will be saved
-
showMessage
protected void showMessage(@CheckForNull Component parentComponent, String title, String message, String strClass, String item, boolean sessionOnly, boolean alwaysRemember, int type) -
getComboBoxLastSelection
Description copied from interface:UserPreferencesManagerThe last selected value in a given combo box.- Specified by:
getComboBoxLastSelectionin interfaceUserPreferencesManager- Parameters:
comboBoxName- the combo box name- Returns:
- the selected value
-
setComboBoxLastSelection
Description copied from interface:UserPreferencesManagerSet the last selected value in a given combo box.The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class, followed by an identifier for the combo box.
- Specified by:
setComboBoxLastSelectionin interfaceUserPreferencesManager- Parameters:
comboBoxName- the combo box namelastValue- the selected value
-
getCheckboxPreferenceState
Description copied from interface:UserPreferencesManagerEnquire as to the state of a user preference.Preferences that have not been set will be considered to be defaultState.
The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class.
- Specified by:
getCheckboxPreferenceStatein interfaceUserPreferencesManager- Parameters:
name- the name of the preferencedefaultState- the default state if not set- Returns:
- the state or defaultState if never set
-
setCheckboxPreferenceState
Description copied from interface:UserPreferencesManagerThis is used to remember the last selected state of a checkBox and thus allow that checkBox to be set to a true state when it is next initialized. This can also be used anywhere else that a simple yes/no, true/false type preference needs to be stored.It should not be used for remembering if a user wants to suppress a message as there is no means in the GUI for the user to reset the flag. setPreferenceState() should be used in this instance The name is free-form, but to avoid ambiguity it should start with the package name (package.Class) for the primary using class.
- Specified by:
setCheckboxPreferenceStatein interfaceUserPreferencesManager- Parameters:
name- A unique name to identify the state being storedstate- simple boolean
-
getChangeMade
-
setChangeMade
-
resetChangeMade
- Specified by:
resetChangeMadein interfaceUserPreferencesManager
-
isLoading
Check if this object is loading preferences from storage.- Returns:
- true if loading preferences; false otherwise
-
setLoading
- Specified by:
setLoadingin interfaceUserPreferencesManager
-
finishLoading
- Specified by:
finishLoadingin interfaceUserPreferencesManager
-
displayRememberMsg
-
getWindowLocation
Description copied from interface:UserPreferencesManagerGet the x,y location of a given Window.- Specified by:
getWindowLocationin interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- the location
-
getWindowSize
Description copied from interface:UserPreferencesManagerReturns the width, height size of a given Window- Specified by:
getWindowSizein interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- the size
-
getSaveWindowSize
- Specified by:
getSaveWindowSizein interfaceUserPreferencesManager
-
getSaveWindowLocation
- Specified by:
getSaveWindowLocationin interfaceUserPreferencesManager
-
setSaveWindowSize
Description copied from interface:UserPreferencesManagerSet if window sizes should be saved for a given class. Method has no effect if strClass is null or equalsjmri.util.JmriJFrame.- Specified by:
setSaveWindowSizein interfaceUserPreferencesManager- Parameters:
strClass- name of the classb- true if window sizes should be saved; false otherwise
-
setSaveWindowLocation
Description copied from interface:UserPreferencesManagerSet if window locations should be saved for a given class. Method has no effect if strClass is null or equalsjmri.util.JmriJFrame.- Specified by:
setSaveWindowLocationin interfaceUserPreferencesManager- Parameters:
strClass- name of the classb- true if window locations should be saved; false otherwise
-
setWindowLocation
Description copied from interface:UserPreferencesManagerSaves the last location of a given component on the screen.The jmri.util.JmriJFrame, will automatically use the class name of the frame if the class name returned is equal to jmri.util.JmriJFrame, the location is not stored
- Specified by:
setWindowLocationin interfaceUserPreferencesManager- Parameters:
strClass- This is a unique identifier for window location being savedlocation- The x,y location of the window given in a Point
-
setWindowSize
Description copied from interface:UserPreferencesManagerSaves the last size of a given component on the screenThe jmri.util.JmriJFrame, will automatically use the class name of the frame if the class name returned is equal to jmri.util.JmriJFrame, the size is not stored
- Specified by:
setWindowSizein interfaceUserPreferencesManager- Parameters:
strClass- This is a unique identifier for window size being saveddim- The width, height size of the window given in a Dimension
-
getWindowList
- Specified by:
getWindowListin interfaceUserPreferencesManager
-
setProperty
Description copied from interface:UserPreferencesManagerAttach a key/value pair to the given class, which can be retrieved later. These are not bound properties as yet, and don't throw events on modification. Key must not be null.- Specified by:
setPropertyin interfaceUserPreferencesManager- Parameters:
strClass- class to usekey- Prior to 4.3.5, this could be an Object.value- value to use
-
getProperty
Description copied from interface:UserPreferencesManagerRetrieve the value associated with a key in a given class If no value has been set for that key, returns null.- Specified by:
getPropertyin interfaceUserPreferencesManager- Parameters:
strClass- class to usekey- item to retrieve- Returns:
- stored value
-
getPropertyKeys
Description copied from interface:UserPreferencesManagerRetrieve the complete current set of keys for a given class.- Specified by:
getPropertyKeysin interfaceUserPreferencesManager- Parameters:
strClass- class to use- Returns:
- complete set of keys
-
hasProperties
Description copied from interface:UserPreferencesManagerCheck if there are properties for the given class- Specified by:
hasPropertiesin interfaceUserPreferencesManager- Parameters:
strClass- class to check- Returns:
- true if properties for strClass are maintained; false otherwise
-
getClassDescription
Description copied from interface:UserPreferencesManagerGet the description of a class/group registered with the preferences.- Specified by:
getClassDescriptionin interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- the description
-
getPreferencesClasses
Description copied from interface:UserPreferencesManagerGet the list of the classes registered with the preference manager.- Specified by:
getPreferencesClassesin interfaceUserPreferencesManager- Returns:
- the list of class names
-
setClassDescription
Given that we know the class as a string, we will try and attempt to gather details about the preferences that has been added, so that we can make better sense of the details in the preferences window.This looks for specific methods within the class called "getClassDescription" and "setMessagePreferencesDetails". If found it will invoke the methods, this will then trigger the class to send details about its preferences back to this code.
- Specified by:
setClassDescriptionin interfaceUserPreferencesManager- Parameters:
strClass- description to use for the class
-
setMessageItemDetails
public void setMessageItemDetails(String strClass, String item, String description, HashMap<Integer, String> options, int defaultOption) Add descriptive details about a specific message box, so that if it needs to be reset in the preferences, then it is easily identifiable. displayed to the user in the preferences GUI.- Specified by:
setMessageItemDetailsin interfaceUserPreferencesManager- Parameters:
strClass- String value of the calling class/groupitem- String value of the specific item this is used for.description- A meaningful description that can be used in a label to describe the itemoptions- A map of the integer value of the option against a meaningful description.defaultOption- The default option for the given item.
-
getChoiceOptions
Description copied from interface:UserPreferencesManagerReturns a map of the value against description of the different items in a given class. This information can then be used to build a Combo box.- Specified by:
getChoiceOptionsin interfaceUserPreferencesManager- Parameters:
strClass- Class or group of the given itemitem- the item which we wish to return the details about.- Returns:
- map of choices
-
getMultipleChoiceSize
Description copied from interface:UserPreferencesManagerGet the number of Multiple Choice items registered with a given class.- Specified by:
getMultipleChoiceSizein interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- number of items
-
getMultipleChoiceList
Description copied from interface:UserPreferencesManagerGet a list of all the multiple choice items registered with a given class.- Specified by:
getMultipleChoiceListin interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- list of item names
-
getChoiceName
Description copied from interface:UserPreferencesManagerGet the nth item name in a given class.- Specified by:
getChoiceNamein interfaceUserPreferencesManager- Parameters:
strClass- the class namen- the position- Returns:
- the item name
-
getChoiceDescription
Description copied from interface:UserPreferencesManagerGet the a meaningful description of a given item in a given class or group.- Specified by:
getChoiceDescriptionin interfaceUserPreferencesManager- Parameters:
strClass- the class nameitem- the item name- Returns:
- the item description
-
getMultipleChoiceOption
Description copied from interface:UserPreferencesManagerGet the current value of a given item in a given class.- Specified by:
getMultipleChoiceOptionin interfaceUserPreferencesManager- Parameters:
strClass- the class nameitem- the item name- Returns:
- the value
-
getMultipleChoiceDefaultOption
Description copied from interface:UserPreferencesManagerReturns the default value of a given item in a given class- Specified by:
getMultipleChoiceDefaultOptionin interfaceUserPreferencesManager- Parameters:
strClass- the class namechoice- the item name- Returns:
- the default value
-
setMultipleChoiceOption
Description copied from interface:UserPreferencesManagerSets the value of a given item in a given class, by its string description.- Specified by:
setMultipleChoiceOptionin interfaceUserPreferencesManager- Parameters:
strClass- the class namechoice- the item namevalue- the item value description
-
setMultipleChoiceOption
Description copied from interface:UserPreferencesManagerSets the value of a given item in a given class, by its integer value.- Specified by:
setMultipleChoiceOptionin interfaceUserPreferencesManager- Parameters:
strClass- the class namechoice- the item namevalue- the item value
-
getClassDescription
-
getClassName
-
getClassPreferences
-
getPreferencesSize
Description copied from interface:UserPreferencesManagerGet the combined size of both types of items registered.- Specified by:
getPreferencesSizein interfaceUserPreferencesManager- Parameters:
strClass- the class name- Returns:
- number of registered preferences
-
readUserPreferences
-
saveElement
-
initialize
Description copied from interface:InstanceManagerAutoInitializePerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initializein interfaceInstanceManagerAutoInitialize
-