|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.XmlFile
jmri.managers.DefaultUserMessagePreferences
@NotThreadSafe public class DefaultUserMessagePreferences
Basic Implementation of the User Preferences Manager.
The User Message Preference Manager keeps track of the options that a user has selected in messages where they have selected "Remember this setting for next time"
| Field Summary |
|---|
| Fields inherited from class jmri.jmrit.XmlFile |
|---|
dtdLocation, xsltLocation |
| Method Summary | |
|---|---|
void |
addComboBoxLastSelection(String comboBoxName,
String lastValue)
Adds the last selection of a combo box. |
void |
addPropertyChangeListener(PropertyChangeListener l)
|
void |
allowSave()
|
void |
disallowSave()
|
void |
displayRememberMsg()
|
void |
finishLoading()
|
boolean |
getChangeMade()
|
String |
getChoiceDescription(String strClass,
String item)
Returns the a meaningful description of a given item in a given class or group. |
String |
getChoiceName(String strClass,
int n)
Returns the nth item name in a given class |
HashMap<Integer,String> |
getChoiceOptions(String strClass,
String item)
Returns a map of the value against description of the different items in a given class. |
String |
getClassDescription()
|
String |
getClassDescription(String strClass)
Returns the description of a class/group registered with the preferences. |
protected String |
getClassName()
|
String |
getComboBoxLastSelection(int n)
returns the ComboBox Value at position n |
String |
getComboBoxLastSelection(String comboBoxName)
returns the last selected value in a given combobox |
String |
getComboBoxName(int n)
returns the ComboBox Name at position n |
int |
getComboBoxSelectionSize()
returns the number of comboBox options saved |
static DefaultUserMessagePreferences |
getInstance()
|
int |
getMultipleChoiceDefaultOption(String strClass,
String choice)
Returns the default value of a given item in a given class |
ArrayList<String> |
getMultipleChoiceList(String strClass)
Returns a list of all the multiple choice items registered with a given class. |
int |
getMultipleChoiceOption(String strClass,
String item)
Returns the current value of a given item in a given class |
int |
getMultipleChoiceSize(String strClass)
Returns the number of Mulitple Choice items registered with a given class. |
String |
getPreferenceItemDescription(String strClass,
String item)
Returns the description of the given item preference in the given class |
String |
getPreferenceItemName(String strClass,
int n)
Returns the itemName of the n preference in the given class |
ArrayList<String> |
getPreferenceList(String strClass)
Returns a list of preferences that are registered against a specific class. |
ArrayList<String> |
getPreferencesClasses()
Returns a list of the classes registered with the preference manager. |
int |
getPreferencesSize(String strClass)
returns the combined size of both types of items registered. |
boolean |
getPreferenceState(String strClass,
String item)
Returns the state of a given item registered against a specific class or item. |
Object |
getProperty(String strClass,
Object key)
Retrieve the value associated with a key in a given class If no value has been set for that key, returns null. |
Set<Object> |
getPropertyKeys(String strClass)
Retrieve the complete current set of keys for a given class. |
boolean |
getSaveWindowLocation(String strClass)
|
boolean |
getSaveWindowSize(String strClass)
|
Dimension |
getScreen()
|
boolean |
getSessionPreferenceState(String name)
Enquire as to the state of a user preference for the current session. |
boolean |
getSimplePreferenceState(String name)
Enquire as to the state of a user preference. |
ArrayList<String> |
getSimplePreferenceStateList()
Returns an ArrayList of the checkbox states set as true. |
ArrayList<String> |
getWindowList()
|
Point |
getWindowLocation(String strClass)
Returns the x,y location of a given Window |
Dimension |
getWindowSize(String strClass)
Returns the width, height size of a given Window |
boolean |
isWindowPositionSaved(String strClass)
Do we have a saved window position for the class |
void |
messageItemDetails(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. |
void |
messageItemDetails(String strClass,
String item,
String description,
String[] msgOption,
int[] msgNumber,
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. |
protected void |
notifyPropertyChangeListener(String property,
Object oldValue,
Object newValue)
|
void |
preferenceItemDetails(String strClass,
String item,
String description)
Register details about a perticular preference, so that it can be displayed in the GUI and provide a meaning full description when presented to the user. |
void |
readUserPreferences()
|
void |
removePropertyChangeListener(PropertyChangeListener l)
|
void |
resetChangeMade()
|
void |
setChangeMade(boolean fireUpdate)
|
void |
setClassDescription(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. |
void |
setComboBoxLastSelection(String comboBoxName,
String lastValue)
sets the last selected value in a given combobox |
void |
setLoading()
|
void |
setMultipleChoiceOption(String strClass,
String choice,
int value)
Sets the value of a given item in a given class, by its integer value |
void |
setMultipleChoiceOption(String strClass,
String choice,
String value)
Sets the value of a given item in a given class, by its string description |
void |
setPreferenceState(String strClass,
String item,
boolean state)
Used to save the state of checkboxes which can suppress messages from being displayed. |
void |
setProperty(String strClass,
Object key,
Object value)
Attach a key/value pair to the given class, which can be retrieved later. |
void |
setSaveWindowLocation(String strClass,
boolean b)
|
void |
setSaveWindowSize(String strClass,
boolean b)
|
void |
setSessionPreferenceState(String name,
boolean state)
Used to surpress messages for a perticular session, the information is not stored, can not be changed via the GUI. |
void |
setSimplePreferenceState(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 initialised. |
void |
setWindowLocation(String strClass,
Point location)
Saves the last location of a given component on the screen. |
void |
setWindowSize(String strClass,
Dimension dim)
Saves the last size 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 size is not stored |
void |
showInfoMessage(String title,
String message,
String strClass,
String item)
Show an info message ("don't forget ...") |
void |
showInfoMessage(String title,
String message,
String strClass,
String item,
boolean sessionOnly,
boolean alwaysRemember,
Level level)
Show an info message ("don't forget ...") |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static DefaultUserMessagePreferences getInstance()
public void allowSave()
allowSave in interface UserPreferencesManagerpublic void disallowSave()
disallowSave in interface UserPreferencesManagerpublic Dimension getScreen()
getScreen in interface UserPreferencesManager
public void setSimplePreferenceState(String name,
boolean state)
setSimplePreferenceState in interface UserPreferencesManagername - A unique name to identify the state being storedstate - simple boolean.public boolean getSimplePreferenceState(String name)
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.
getSimplePreferenceState in interface UserPreferencesManagerpublic ArrayList<String> getSimplePreferenceStateList()
getSimplePreferenceStateList in interface UserPreferencesManager
public void setPreferenceState(String strClass,
String item,
boolean state)
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.
setPreferenceState in interface UserPreferencesManagerstrClass - 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.
public boolean getPreferenceState(String strClass,
String item)
getPreferenceState in interface UserPreferencesManager
public void preferenceItemDetails(String strClass,
String item,
String description)
preferenceItemDetails in interface UserPreferencesManagerstrClass - A string form of the class that the preference is stored or grouped withitem - The specific item that is being stored.description - A meaningful decription of the item that the user will understand.public ArrayList<String> getPreferenceList(String strClass)
getPreferenceList in interface UserPreferencesManager
public String getPreferenceItemName(String strClass,
int n)
getPreferenceItemName in interface UserPreferencesManager
public String getPreferenceItemDescription(String strClass,
String item)
getPreferenceItemDescription in interface UserPreferencesManager
public void setSessionPreferenceState(String name,
boolean state)
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.
setSessionPreferenceState in interface UserPreferencesManagername - A unique identifer for preference.state - public boolean getSessionPreferenceState(String name)
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.
getSessionPreferenceState in interface UserPreferencesManager
public void showInfoMessage(String title,
String message,
String strClass,
String item)
showInfoMessage in interface UserPreferencesManagertitle - Message Box titlemessage - Message to be displayedstrClass - String value of the calling classitem - String value of the specific item this is used for
public void showInfoMessage(String title,
String message,
String strClass,
String item,
boolean sessionOnly,
boolean alwaysRemember,
Level level)
showInfoMessage in interface UserPreferencesManagertitle - 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 savedlevel - Used to determine the type of messagebox that will be used.
public void addComboBoxLastSelection(String comboBoxName,
String lastValue)
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 combobox
addComboBoxLastSelection in interface UserPreferencesManagerpublic String getComboBoxLastSelection(String comboBoxName)
getComboBoxLastSelection in interface UserPreferencesManager
public void setComboBoxLastSelection(String comboBoxName,
String lastValue)
setComboBoxLastSelection in interface UserPreferencesManagerpublic int getComboBoxSelectionSize()
getComboBoxSelectionSize in interface UserPreferencesManagerpublic String getComboBoxName(int n)
getComboBoxName in interface UserPreferencesManagerpublic String getComboBoxLastSelection(int n)
getComboBoxLastSelection in interface UserPreferencesManagerpublic boolean getChangeMade()
public void setChangeMade(boolean fireUpdate)
public void resetChangeMade()
resetChangeMade in interface UserPreferencesManagerpublic void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener in interface UserPreferencesManagerpublic void addPropertyChangeListener(PropertyChangeListener l)
addPropertyChangeListener in interface UserPreferencesManager
protected void notifyPropertyChangeListener(String property,
Object oldValue,
Object newValue)
public void setLoading()
setLoading in interface UserPreferencesManagerpublic void finishLoading()
finishLoading in interface UserPreferencesManagerpublic void displayRememberMsg()
public Point getWindowLocation(String strClass)
UserPreferencesManager
getWindowLocation in interface UserPreferencesManagerpublic Dimension getWindowSize(String strClass)
UserPreferencesManager
getWindowSize in interface UserPreferencesManagerpublic boolean getSaveWindowSize(String strClass)
getSaveWindowSize in interface UserPreferencesManagerpublic boolean getSaveWindowLocation(String strClass)
getSaveWindowLocation in interface UserPreferencesManager
public void setSaveWindowSize(String strClass,
boolean b)
setSaveWindowSize in interface UserPreferencesManager
public void setSaveWindowLocation(String strClass,
boolean b)
setSaveWindowLocation in interface UserPreferencesManager
public void setWindowLocation(String strClass,
Point location)
UserPreferencesManagerThe 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
setWindowLocation in interface UserPreferencesManagerstrClass - This is a unique identifier for window location being savedlocation - The x,y location of the window given in a Point
public void setWindowSize(String strClass,
Dimension dim)
UserPreferencesManagerThe 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
setWindowSize in interface UserPreferencesManagerstrClass - This is a unique identifier for window size being saveddim - The width, height size of the window given in a Dimensionpublic ArrayList<String> getWindowList()
getWindowList in interface UserPreferencesManager
public void setProperty(String strClass,
Object key,
Object value)
UserPreferencesManager
setProperty in interface UserPreferencesManager
public Object getProperty(String strClass,
Object key)
UserPreferencesManager
getProperty in interface UserPreferencesManagerpublic Set<Object> getPropertyKeys(String strClass)
UserPreferencesManager
getPropertyKeys in interface UserPreferencesManagerpublic boolean isWindowPositionSaved(String strClass)
UserPreferencesManager
isWindowPositionSaved in interface UserPreferencesManagerpublic String getClassDescription(String strClass)
getClassDescription in interface UserPreferencesManagerpublic ArrayList<String> getPreferencesClasses()
getPreferencesClasses in interface UserPreferencesManagerpublic void setClassDescription(String strClass)
This looks for specific methods within the class called "getClassDescription" and "setMessagePreferenceDetails". If found it will invoke the methods, this will then trigger the class to send details about its preferences back to this code.
setClassDescription in interface UserPreferencesManager
public void messageItemDetails(String strClass,
String item,
String description,
String[] msgOption,
int[] msgNumber,
int defaultOption)
messageItemDetails in interface UserPreferencesManagerstrClass - 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 itemmsgOption - Description of each option valid option.msgNumber - The references number against which the Description is refering too.defaultOption - The default option for the given item.
public void messageItemDetails(String strClass,
String item,
String description,
HashMap<Integer,String> options,
int defaultOption)
messageItemDetails in interface UserPreferencesManagerstrClass - 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.
public HashMap<Integer,String> getChoiceOptions(String strClass,
String item)
getChoiceOptions in interface UserPreferencesManagerstrClass - Class or group of the given itemitem - the item which we wish to return the details about.public int getMultipleChoiceSize(String strClass)
getMultipleChoiceSize in interface UserPreferencesManagerpublic ArrayList<String> getMultipleChoiceList(String strClass)
getMultipleChoiceList in interface UserPreferencesManager
public String getChoiceName(String strClass,
int n)
getChoiceName in interface UserPreferencesManager
public String getChoiceDescription(String strClass,
String item)
getChoiceDescription in interface UserPreferencesManager
public int getMultipleChoiceOption(String strClass,
String item)
getMultipleChoiceOption in interface UserPreferencesManager
public int getMultipleChoiceDefaultOption(String strClass,
String choice)
getMultipleChoiceDefaultOption in interface UserPreferencesManager
public void setMultipleChoiceOption(String strClass,
String choice,
String value)
setMultipleChoiceOption in interface UserPreferencesManager
public void setMultipleChoiceOption(String strClass,
String choice,
int value)
setMultipleChoiceOption in interface UserPreferencesManagerpublic String getClassDescription()
protected String getClassName()
public int getPreferencesSize(String strClass)
getPreferencesSize in interface UserPreferencesManagerpublic void readUserPreferences()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||