Package jmri
Class TurnoutOperationManager
java.lang.Object
jmri.TurnoutOperationManager
- All Implemented Interfaces:
InstanceManagerAutoDefault
class to look after the collection of TurnoutOperation subclasses Unlike the
other xxxManager, this does not inherit from AbstractManager since the
resources it deals with are not DCC system resources but rather purely
internal state.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) PropertyChangeSupportProperty change support. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd a new operation Silently replaces any existing operation with the same namevoidstatic String[]concatenateTypeLists(String[] types) Proxy support.voiddispose()protected voidfirePropertyChange(String p, Object old, Object n) booleanGet ( potentially update ) status of whether operations are in use.getMatchingOperation(Turnout t, int apparentMode) Find the correct operation for this turnout.getMatchingOperationAlways(Turnout t, int apparentMode) Find a suitable operation for this turnout, based on its feedback type.getOperation(String name) Find a TurnoutOperation by its name.getTooltipForOperator(String operatorName, Turnout t) Get a ToolTip or descriptive comment for the Operator.voidLoad the operation types given by the current TurnoutManager instance, in the order given.protected voidvoidvoidsetDoOperations(boolean b) Set that Turnout Operations are in use.
-
Field Details
-
doOperations
boolean doOperations -
pcs
Property change support.
-
-
Constructor Details
-
TurnoutOperationManager
public TurnoutOperationManager()
-
-
Method Details
-
dispose
-
getTurnoutOperations
-
addOperation
add a new operation Silently replaces any existing operation with the same name- Parameters:
op-TurnoutOperationto add/replace
-
removeOperation
-
getOperation
Find a TurnoutOperation by its name.- Parameters:
name- name ofTurnoutOperationto retrieve.- Returns:
- the operation
-
loadOperationTypes
Load the operation types given by the current TurnoutManager instance, in the order given.The order is important because the acceptable feedback modes may overlap. All we do is instantiate the classes. The constructors take care of putting everything in the right places. We allow multiple occurrences of the same name without complaining so the Proxy stuff works. There's a threading problem here, because this invokes gets the current turnout manager, often the proxy manager, which in turn invokes loadOperationTypes again. This is bad. It's not clear why it even works.
-
getMatchingOperationAlways
Find a suitable operation for this turnout, based on its feedback type. The mode is passed separately so the caller can transform it- Parameters:
t- turnoutapparentMode- Turnout Feedback mode(s) to be used when finding a matching operation- Returns:
- the turnout operation
-
getMatchingOperation
Find the correct operation for this turnout. If operations are globally disabled, return null.- Parameters:
t- turnoutapparentMode- mode(s) to be used when finding a matching operation- Returns:
- operation
-
getMatchingOperationAlways
-
getDoOperations
Get ( potentially update ) status of whether operations are in use.- Returns:
- true if in use, else false.
-
setDoOperations
Set that Turnout Operations are in use.- Parameters:
b- true to use, else false to disable.
-
concatenateTypeLists
Proxy support. Take a concatenation of operation type lists from multiple systems and turn it into a single list, by eliminating duplicates and ensuring that NoFeedback - which matches anything - comes at the end if it is present at all.- Parameters:
types- list of types possibly containing duplicates- Returns:
- list reduced as described above
-
addPropertyChangeListener
-
removePropertyChangeListener
-
firePropertyChange
-
getTooltipForOperator
Get a ToolTip or descriptive comment for the Operator.- Parameters:
operatorName- name of the Turnout Operatort- The Turnout that the Operator would operate- Returns:
- Descriptive String, or null.
-