Package jmri.jmrit.logix
Class WarrantPreferences
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- jmri.util.prefs.AbstractPreferencesManager
-
- jmri.jmrit.logix.WarrantPreferences
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
,JmriServiceProviderInterface
,PreferencesManager
public class WarrantPreferences extends AbstractPreferencesManager
Hold configuration data for Warrants, includes Speed Map
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WarrantPreferences.Shutdown
static class
WarrantPreferences.WarrantPreferencesXml
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPEARANCE_PREFS
static java.lang.String
APPEARANCES
static java.lang.String
INTERPRETATION
static java.lang.String
LAYOUT_PARAMS
static java.lang.String
LAYOUT_SCALE
static java.lang.String
MERGE_ALL
static java.lang.String
NO_MERGE
static java.lang.String
PROMPT
static java.lang.String
RAMP_INCREMENT
static java.lang.String
RAMP_PREFS
static java.lang.String
SEARCH_DEPTH
static java.lang.String
SHUT_DOWN
static java.lang.String
SPEED_ASSISTANCE
static java.lang.String
SPEED_MAP_PARAMS
static java.lang.String
SPEED_NAME_PREFS
static java.lang.String
SPEED_NAMES
static java.lang.String
STEP_INCREMENTS
static java.lang.String
THROTTLE_SCALE
static java.lang.String
TIME_INCREMENT
static java.lang.String
TRACE
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description WarrantPreferences()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>>
getAppearanceEntryIterator()
java.util.HashMap<java.lang.String,java.lang.String>
getAppearances()
Get a map of signal head appearances.(package private) java.lang.String
getAppearanceValue(java.lang.String key)
static WarrantPreferences
getDefault()
Get the default instance.int
getInterpretation()
float
getLayoutScale()
Get the layout scale.(package private) int
getSearchDepth()
WarrantPreferences.Shutdown
getShutdown()
(package private) float
getSpeedAssistance()
(package private) java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Float>>
getSpeedNameEntryIterator()
java.util.HashMap<java.lang.String,java.lang.Float>
getSpeedNames()
(package private) java.lang.Float
getSpeedNameValue(java.lang.String key)
float
getThrottleIncrement()
Get the throttle increment.float
getThrottleScale()
int
getTimeIncrement()
Get the time increment.(package private) boolean
getTrace()
void
initialize(Profile profile)
Initialize the PreferencesManager with preferences associated with the provided Profile.void
loadLayoutParams(org.jdom2.Element layoutParm)
void
openFile(java.lang.String name)
void
save()
void
savePreferences(Profile profile)
Save the preferences that this provider manages for the provided Profile.protected void
setAppearances(java.util.ArrayList<WarrantPreferencesPanel.DataPair<java.lang.String,java.lang.String>> appearanceMap)
(package private) void
setInterpretation(int interp)
void
setLayoutScale(float scale)
Set the layout scale.(package private) void
setSearchDepth(int depth)
void
setShutdown(WarrantPreferences.Shutdown set)
(package private) void
setSpeedAssistance(float f)
protected void
setSpeedNames(java.util.ArrayList<WarrantPreferencesPanel.DataPair<java.lang.String,java.lang.Float>> speedNameMap)
void
setThrottleIncrement(float increment)
Set the throttle increment.void
setThrottleScale(float scale)
void
setTimeIncrement(int increment)
Set the time increment.(package private) void
setTrace(boolean t)
boolean
store(org.jdom2.Element root)
-
Methods inherited from class jmri.util.prefs.AbstractPreferencesManager
addInitializationException, getInitializationExceptions, getProvides, getRequires, 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
-
LAYOUT_PARAMS
public static final java.lang.String LAYOUT_PARAMS
- See Also:
- Constant Field Values
-
LAYOUT_SCALE
public static final java.lang.String LAYOUT_SCALE
- See Also:
- Constant Field Values
-
SEARCH_DEPTH
public static final java.lang.String SEARCH_DEPTH
- See Also:
- Constant Field Values
-
SPEED_MAP_PARAMS
public static final java.lang.String SPEED_MAP_PARAMS
- See Also:
- Constant Field Values
-
RAMP_PREFS
public static final java.lang.String RAMP_PREFS
- See Also:
- Constant Field Values
-
TIME_INCREMENT
public static final java.lang.String TIME_INCREMENT
- See Also:
- Constant Field Values
-
THROTTLE_SCALE
public static final java.lang.String THROTTLE_SCALE
- See Also:
- Constant Field Values
-
RAMP_INCREMENT
public static final java.lang.String RAMP_INCREMENT
- See Also:
- Constant Field Values
-
STEP_INCREMENTS
public static final java.lang.String STEP_INCREMENTS
- See Also:
- Constant Field Values
-
SPEED_NAME_PREFS
public static final java.lang.String SPEED_NAME_PREFS
- See Also:
- Constant Field Values
-
SPEED_NAMES
public static final java.lang.String SPEED_NAMES
- See Also:
- Constant Field Values
-
INTERPRETATION
public static final java.lang.String INTERPRETATION
- See Also:
- Constant Field Values
-
APPEARANCE_PREFS
public static final java.lang.String APPEARANCE_PREFS
- See Also:
- Constant Field Values
-
APPEARANCES
public static final java.lang.String APPEARANCES
- See Also:
- Constant Field Values
-
SHUT_DOWN
public static final java.lang.String SHUT_DOWN
- See Also:
- Constant Field Values
-
NO_MERGE
public static final java.lang.String NO_MERGE
- See Also:
- Constant Field Values
-
PROMPT
public static final java.lang.String PROMPT
- See Also:
- Constant Field Values
-
MERGE_ALL
public static final java.lang.String MERGE_ALL
- See Also:
- Constant Field Values
-
TRACE
public static final java.lang.String TRACE
- See Also:
- Constant Field Values
-
SPEED_ASSISTANCE
public static final java.lang.String SPEED_ASSISTANCE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WarrantPreferences
public WarrantPreferences()
-
-
Method Detail
-
getDefault
public static WarrantPreferences getDefault()
Get the default instance.- Returns:
- the default instance, creating it if necessary
-
openFile
public void openFile(java.lang.String name)
-
loadLayoutParams
public void loadLayoutParams(org.jdom2.Element layoutParm)
-
save
public void save()
-
store
public boolean store(org.jdom2.Element root)
-
getLayoutScale
public final float getLayoutScale()
Get the layout scale.- Returns:
- the scale
-
setLayoutScale
public void setLayoutScale(float scale)
Set the layout scale.- Parameters:
scale
- the scale
-
getThrottleScale
public float getThrottleScale()
-
setThrottleScale
public void setThrottleScale(float scale)
-
getSearchDepth
int getSearchDepth()
-
setSearchDepth
void setSearchDepth(int depth)
-
getTrace
boolean getTrace()
-
setTrace
void setTrace(boolean t)
-
getSpeedAssistance
float getSpeedAssistance()
-
setSpeedAssistance
void setSpeedAssistance(float f)
-
getSpeedNameEntryIterator
java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Float>> getSpeedNameEntryIterator()
-
getSpeedNameValue
java.lang.Float getSpeedNameValue(java.lang.String key)
-
getSpeedNames
@Nonnull @CheckReturnValue public java.util.HashMap<java.lang.String,java.lang.Float> getSpeedNames()
-
setSpeedNames
protected void setSpeedNames(@Nonnull java.util.ArrayList<WarrantPreferencesPanel.DataPair<java.lang.String,java.lang.Float>> speedNameMap)
-
getAppearanceEntryIterator
java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> getAppearanceEntryIterator()
-
getAppearanceValue
java.lang.String getAppearanceValue(java.lang.String key)
-
getAppearances
@Nonnull @CheckReturnValue public java.util.HashMap<java.lang.String,java.lang.String> getAppearances()
Get a map of signal head appearances.- Returns:
- a map of appearances or an empty map if none are defined
-
setAppearances
protected void setAppearances(java.util.ArrayList<WarrantPreferencesPanel.DataPair<java.lang.String,java.lang.String>> appearanceMap)
-
getInterpretation
public int getInterpretation()
-
setInterpretation
void setInterpretation(int interp)
-
getTimeIncrement
public final int getTimeIncrement()
Get the time increment.- Returns:
- the time increment in milliseconds
-
setTimeIncrement
public void setTimeIncrement(int increment)
Set the time increment.- Parameters:
increment
- the time increment in milliseconds
-
getThrottleIncrement
public final float getThrottleIncrement()
Get the throttle increment.- Returns:
- the throttle increment
-
setThrottleIncrement
public void setThrottleIncrement(float increment)
Set the throttle increment.- Parameters:
increment
- the throttle increment
-
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
-
setShutdown
public void setShutdown(WarrantPreferences.Shutdown set)
-
getShutdown
public WarrantPreferences.Shutdown getShutdown()
-
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
-
-