Class SystemConsolePreferencesManager
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- apps.systemconsole.SystemConsolePreferencesManager
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
,JmriServiceProviderInterface
,PreferencesManager
public class SystemConsolePreferencesManager extends Bean implements PreferencesManager
Manage preferences for theSystemConsole
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FONT_SIZE
static java.lang.String
FONT_STYLE
static java.lang.String
SCHEME
static java.lang.String
WRAP_STYLE
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description SystemConsolePreferencesManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getFontSize()
int
getFontStyle()
java.util.List<java.lang.Exception>
getInitializationExceptions(Profile profile)
Get the set of exceptions thrown during initialization for the provided Profile.java.lang.Iterable<java.lang.Class<?>>
getProvides()
Get the set of Classes that this PreferencesManager can be registered as a provider of in theInstanceManager
.java.util.Collection<java.lang.Class<? extends PreferencesManager>>
getRequires()
Get the set of PreferencesManagers that must be initialized prior to initializing this PreferencesManager.int
getScheme()
int
getWrapStyle()
void
initialize(Profile profile)
Initialize the PreferencesManager with preferences associated with the provided Profile.boolean
isInitialized(Profile profile)
Test if the PreferencesManager is initialized without errors for the provided Profile.boolean
isInitializedWithExceptions(Profile profile)
Test if the PreferencesManager is initialized, but threw anInitializationException
during initialization, for the provided Profile.void
savePreferences(Profile profile)
Save the preferences that this provider manages for the provided Profile.void
setFontSize(int fontSize)
Sets the fontSize.void
setFontStyle(int fontStyle)
void
setScheme(int scheme)
void
setWrapStyle(int wrapStyle)
-
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
-
SCHEME
public static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
FONT_SIZE
public static final java.lang.String FONT_SIZE
- See Also:
- Constant Field Values
-
FONT_STYLE
public static final java.lang.String FONT_STYLE
- See Also:
- Constant Field Values
-
WRAP_STYLE
public static final java.lang.String WRAP_STYLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SystemConsolePreferencesManager
public SystemConsolePreferencesManager()
-
-
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.- Specified by:
initialize
in interfacePreferencesManager
- 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.- Specified by:
savePreferences
in interfacePreferencesManager
- 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
-
isInitialized
public boolean isInitialized(Profile profile)
Description copied from interface:PreferencesManager
Test if the PreferencesManager is initialized without errors for the provided Profile. Note that although both this method andPreferencesManager.isInitializedWithExceptions(jmri.profile.Profile)
can be false, if isInitializedWithExceptions(Profile) returns true, this method must return false.- Specified by:
isInitialized
in interfacePreferencesManager
- Parameters:
profile
- the configuration profile to test against; may be null to test for exceptions thrown when initializing for this user regardless of profile- Returns:
- true if the provider is initialized without exceptions
-
getRequires
@Nonnull public java.util.Collection<java.lang.Class<? extends PreferencesManager>> getRequires()
Description copied from interface:PreferencesManager
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.
- Specified by:
getRequires
in interfacePreferencesManager
- Returns:
- A set or list of classes. If there are no dependencies, return an empty set instead of null.
-
getProvides
@Nonnull public java.lang.Iterable<java.lang.Class<?>> getProvides()
Description copied from interface:PreferencesManager
Get the set of Classes that this PreferencesManager can be registered as a provider of in theInstanceManager
.- Specified by:
getProvides
in interfacePreferencesManager
- Returns:
- A set or list of classes. If this PreferencesManager provides an instance of no other Interfaces or abstract Classes than PreferencesManager, return an empty set instead of null.
-
getScheme
public int getScheme()
- Returns:
- the scheme
-
setScheme
public void setScheme(int scheme)
- Parameters:
scheme
- the scheme to set
-
getFontSize
public int getFontSize()
- Returns:
- the fontSize
-
setFontSize
public void setFontSize(int fontSize)
Sets the fontSize.If the parameter is less than 6, the fontSize is set to 6. If the parameter is greater than 24, the fontSize is set to 24.
- Parameters:
fontSize
- the fontSize to set
-
getFontStyle
public int getFontStyle()
- Returns:
- the fontStyle
-
setFontStyle
public void setFontStyle(int fontStyle)
- Parameters:
fontStyle
- one ofFont.BOLD
,Font.ITALIC
, orFont.PLAIN
.
-
getWrapStyle
public int getWrapStyle()
- Returns:
- the wrapStyle
-
setWrapStyle
public void setWrapStyle(int wrapStyle)
- Parameters:
wrapStyle
- One ofSystemConsole.WRAP_STYLE_LINE
,SystemConsole.WRAP_STYLE_NONE
, orSystemConsole.WRAP_STYLE_WORD
.
-
isInitializedWithExceptions
public boolean isInitializedWithExceptions(Profile profile)
Description copied from interface:PreferencesManager
Test if the PreferencesManager is initialized, but threw anInitializationException
during initialization, for the provided Profile. Note that although both this method andPreferencesManager.isInitialized(jmri.profile.Profile)
can be false, if isInitialized(Profile) returns true, this method must return false.- Specified by:
isInitializedWithExceptions
in interfacePreferencesManager
- Parameters:
profile
- the configuration profile to test against; may be null to test for exceptions thrown when initializing for this user regardless of profile- Returns:
- true if the provide is initialized with exceptions
-
getInitializationExceptions
@Nonnull public java.util.List<java.lang.Exception> getInitializationExceptions(Profile profile)
Description copied from interface:PreferencesManager
Get the set of exceptions thrown during initialization for the provided Profile.- Specified by:
getInitializationExceptions
in interfacePreferencesManager
- Parameters:
profile
- the configuration profile to test against; may be null to test for exceptions thrown when initializing for this user regardless of profile- Returns:
- A list of exceptions. If there are no exceptions, return an empty set instead of null.
-
-