Class ManagerDefaultSelector
- All Implemented Interfaces:
BeanInterface,PropertyChangeFirer,PropertyChangeProvider,JmriServiceProviderInterface,PreferencesManager
Provided that a connection provides a default, this verifies, unless the
per-profile property jmri-managers.allInternalDefaults is
true, that a non-Internal connection (other than type None in the
preferences window) is the default for at least one type of manager.
allInternalDefaults is preserved as a preference when set here, but
setAllInternalDefaultsValid(boolean) is not (originally) invoked from the
GUI.
- Since:
- 2.9.4
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class jmri.beans.Bean
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLoad into InstanceManagergetDefault(Class<?> managerClass) Return the userName of the system that provides the default instance for a specific class.voidinitialize(Profile profile) Initialize the PreferencesManager with preferences associated with the provided Profile.booleanCheck if having all defaults assigned to internal connections should be considered is valid in the presence of an external System Connection.booleanisPreferencesValid(Profile profile) (package private) voidremoveConnectionAsDefault(String removedName) voidsavePreferences(Profile profile) Save the preferences that this provider manages for the provided Profile.voidsetAllInternalDefaultsValid(boolean isAllInternalDefaultsValid) Set if having all defaults assigned to internal connections should be considered is valid in the presence of an external System Connection.voidsetDefault(Class<?> managerClass, String userName) Record the userName of the system that provides the default instance for a specific class.Methods inherited from class jmri.util.prefs.AbstractPreferencesManager
addInitializationException, getInitializationExceptions, getProvides, getRequires, isInitialized, isInitializedWithExceptions, isInitializing, requireAllOther, requiresNoInitializedWithExceptions, requiresNoInitializedWithExceptions, setInitialized, setInitializingMethods 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, setProperty
-
Field Details
-
defaults
-
ALL_INTERNAL_DEFAULTS
- See Also:
-
knownManagers
-
-
Constructor Details
-
ManagerDefaultSelector
public ManagerDefaultSelector()
-
-
Method Details
-
removeConnectionAsDefault
-
getDefault
Return the userName of the system that provides the default instance for a specific class.- Parameters:
managerClass- the specific type, for example, TurnoutManager, for which a default system is desired- Returns:
- userName of the system, or null if none set
-
setDefault
Record the userName of the system that provides the default instance for a specific class.To ensure compatibility of different preference versions, only classes that are current registered are preserved. This way, reading in an old file will just have irrelevant items ignored.
- Parameters:
managerClass- the specific type, for example, TurnoutManager, for which a default system is desireduserName- of the system, or null if none set
-
configure
Load into InstanceManager- Parameters:
profile- the profile to configure against- Returns:
- an exception that can be passed to the user or null if no errors occur
-
initialize
Description copied from interface:PreferencesManagerInitialize the PreferencesManager with preferences associated with the provided Profile.Implementing classes should throw an InitializationException with a user readable localized message, since it most likely be displayed to the user. Implementing classes will still want to ensure that
PreferencesManager.isInitialized(jmri.profile.Profile)orPreferencesManager.isInitializedWithExceptions(jmri.profile.Profile)return true if throwing an InitializationException to ensure that the provider is not repeatedly initialized.- Parameters:
profile- the configuration profile used for this initialization; may be null to initialize for this user regardless of profile- Throws:
InitializationException- if the user needs to be notified of an issue that prevents regular use of the application
-
savePreferences
Description copied from interface:PreferencesManagerSave the preferences that this provider manages for the provided Profile.- Parameters:
profile- the profile associated with the preferences to save; may be null to save preferences that apply to the current user regardless of profile
-
isPreferencesValid
-
isAllInternalDefaultsValid
Check if having all defaults assigned to internal connections should be considered is valid in the presence of an external System Connection.- Returns:
- true if having all internal defaults should be valid; false otherwise
-
setAllInternalDefaultsValid
Set if having all defaults assigned to internal connections should be considered is valid in the presence of an external System Connection.- Parameters:
isAllInternalDefaultsValid- true if having all internal defaults should be valid; false otherwise
-