Class RosterConfigManager
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- jmri.util.prefs.AbstractPreferencesManager
-
- jmri.jmrit.roster.RosterConfigManager
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
,JmriServiceProviderInterface
,PreferencesManager
public class RosterConfigManager extends AbstractPreferencesManager
Load and store the Roster configuration. This only configures the Roster when initialized so that configuration changes made by users do not affect the running instance of JMRI, but only take effect after restarting JMRI.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_OWNER
static java.lang.String
DIRECTORY
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description RosterConfigManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDefaultOwner()
Get the default owner for the active profile.java.lang.String
getDefaultOwner(Profile profile)
Get the default owner for the specified profile.java.lang.String
getDirectory()
Get the roster directory for the active profile.java.lang.String
getDirectory(Profile profile)
Get the roster directory for the specified profile.java.util.Set<java.lang.Class<? extends PreferencesManager>>
getRequires()
Get the set of PreferencesManagers that must be initialized prior to initializing this PreferencesManager.Roster
getRoster(Profile profile)
Get the roster for the profile.void
initialize(Profile profile)
Initialize the PreferencesManager with preferences associated with the provided Profile.void
savePreferences(Profile profile)
Save the preferences that this provider manages for the provided Profile.void
setDefaultOwner(Profile profile, java.lang.String defaultOwner)
Set the default owner for the specified profile.void
setDirectory(Profile profile, java.lang.String directory)
Set the roster directory for the specified profile.Roster
setRoster(Profile profile, Roster roster)
Set the roster for the profile.-
Methods inherited from class jmri.util.prefs.AbstractPreferencesManager
addInitializationException, getInitializationExceptions, getProvides, isInitialized, isInitializedWithExceptions, isInitializing, requireAllOther, requiresNoInitializedWithExceptions, requiresNoInitializedWithExceptions, setInitialized, setInitializing
-
Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
-
-
-
Field Detail
-
DIRECTORY
public static final java.lang.String DIRECTORY
- See Also:
- Constant Field Values
-
DEFAULT_OWNER
public static final java.lang.String DEFAULT_OWNER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RosterConfigManager
public RosterConfigManager()
-
-
Method Detail
-
initialize
public void initialize(Profile profile) throws InitializationException
Description copied from interface:PreferencesManager
Initialize 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
public void savePreferences(Profile profile)
Description copied from interface:PreferencesManager
Save 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
-
getRequires
@Nonnull public java.util.Set<java.lang.Class<? extends PreferencesManager>> getRequires()
Description copied from class:AbstractPreferencesManager
Get the set of PreferencesManagers that must be initialized prior to initializing this PreferencesManager. It is generally preferable to require an Interface or an abstract Class instead of a concrete Class, since that allows all (or any) concrete implementations of the required class to be initialized to provide required services for the requiring PreferencesManager instance.Note that for any set of PreferencesManagers with the same requirements, or with a circular dependency between each other, the order in which the PreferencesManagers in that set are initialized should be considered non-deterministic.
This implementation includes a default dependency on the
ConnectionConfigManager
.- Specified by:
getRequires
in interfacePreferencesManager
- Overrides:
getRequires
in classAbstractPreferencesManager
- Returns:
- An set of classes; if there are no dependencies, return an empty set instead of null; overriding implementations may add to this set directly
-
getDefaultOwner
@Nonnull public java.lang.String getDefaultOwner()
Get the default owner for the active profile.- Returns:
- the default owner
-
getDefaultOwner
@Nonnull public java.lang.String getDefaultOwner(@CheckForNull Profile profile)
Get the default owner for the specified profile.- Parameters:
profile
- the profile to get the default owner for- Returns:
- the default owner
-
setDefaultOwner
public void setDefaultOwner(@CheckForNull Profile profile, @CheckForNull java.lang.String defaultOwner)
Set the default owner for the specified profile.- Parameters:
profile
- the profile to set the default owner fordefaultOwner
- the default owner to set
-
getDirectory
@Nonnull public java.lang.String getDirectory()
Get the roster directory for the active profile.- Returns:
- the directory
-
getDirectory
@Nonnull public java.lang.String getDirectory(@CheckForNull Profile profile)
Get the roster directory for the specified profile.- Parameters:
profile
- the profile to get the directory for- Returns:
- the directory
-
setDirectory
public void setDirectory(@CheckForNull Profile profile, @CheckForNull java.lang.String directory)
Set the roster directory for the specified profile.- Parameters:
profile
- the profile to set the directory fordirectory
- the directory to set
-
getRoster
@Nonnull public Roster getRoster(@CheckForNull Profile profile)
Get the roster for the profile.- Parameters:
profile
- the profile to get the roster for- Returns:
- the roster for the profile
-
-