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 classWarrantPreferences.Shutdownstatic classWarrantPreferences.WarrantPreferencesXml
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPPEARANCE_PREFSstatic java.lang.StringAPPEARANCESstatic java.lang.StringINTERPRETATIONstatic java.lang.StringLAYOUT_PARAMSstatic java.lang.StringLAYOUT_SCALEstatic java.lang.StringMERGE_ALLstatic java.lang.StringNO_MERGEstatic java.lang.StringPROMPTstatic java.lang.StringRAMP_INCREMENTstatic java.lang.StringRAMP_PREFSstatic java.lang.StringSEARCH_DEPTHstatic java.lang.StringSHUT_DOWNstatic java.lang.StringSPEED_ASSISTANCEstatic java.lang.StringSPEED_MAP_PARAMSstatic java.lang.StringSPEED_NAME_PREFSstatic java.lang.StringSPEED_NAMESstatic java.lang.StringSTEP_INCREMENTSstatic java.lang.StringTHROTTLE_SCALEstatic java.lang.StringTIME_INCREMENTstatic java.lang.StringTRACE-
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.StringgetAppearanceValue(java.lang.String key)static WarrantPreferencesgetDefault()Get the default instance.intgetInterpretation()floatgetLayoutScale()Get the layout scale.(package private) intgetSearchDepth()WarrantPreferences.ShutdowngetShutdown()(package private) floatgetSpeedAssistance()(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.FloatgetSpeedNameValue(java.lang.String key)floatgetThrottleIncrement()Get the throttle increment.floatgetThrottleScale()intgetTimeIncrement()Get the time increment.(package private) booleangetTrace()voidinitialize(Profile profile)Initialize the PreferencesManager with preferences associated with the provided Profile.voidloadLayoutParams(org.jdom2.Element layoutParm)voidopenFile(java.lang.String name)voidsave()voidsavePreferences(Profile profile)Save the preferences that this provider manages for the provided Profile.protected voidsetAppearances(java.util.ArrayList<WarrantPreferencesPanel.DataPair<java.lang.String,java.lang.String>> appearanceMap)(package private) voidsetInterpretation(int interp)voidsetLayoutScale(float scale)Set the layout scale.(package private) voidsetSearchDepth(int depth)voidsetShutdown(WarrantPreferences.Shutdown set)(package private) voidsetSpeedAssistance(float f)protected voidsetSpeedNames(java.util.ArrayList<WarrantPreferencesPanel.DataPair<java.lang.String,java.lang.Float>> speedNameMap)voidsetThrottleIncrement(float increment)Set the throttle increment.voidsetThrottleScale(float scale)voidsetTimeIncrement(int increment)Set the time increment.(package private) voidsetTrace(boolean t)booleanstore(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: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
-
setShutdown
public void setShutdown(WarrantPreferences.Shutdown set)
-
getShutdown
public WarrantPreferences.Shutdown getShutdown()
-
savePreferences
public void savePreferences(Profile profile)
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
-
-