Package jmri.server.json.consist
Class JsonConsistManager
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- jmri.server.json.consist.JsonConsistManager
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
,ConsistManager
public class JsonConsistManager extends Bean implements ConsistManager
ConsistManager for the JSON services. This consist manager passes requests for CS consisting to the
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.ConsistManager
ConsistManager.EnableListener
-
-
Field Summary
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description JsonConsistManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConsistListListener(ConsistListListener listener)
Register a ConsistListListener object with this ConsistManagerboolean
csConsistNeedsSeperateAddress()
Does a command station consist require a separate consist address from locomotives in consist?java.lang.String
decodeErrorCode(int errorCode)
Translate Error Codes relieved by a consistListener into Stringsvoid
delConsist(LocoAddress address)
Remove an old Consist.Consist
getConsist(LocoAddress address)
Find a Consist with this consist address, and return it.java.util.ArrayList<LocoAddress>
getConsistList()
Get a list of known consist addresses.boolean
isCommandStationConsistPossible()
Does this implementation support Command Station Consists?boolean
isConsistManager()
Test if a real ConsistManager is available.void
notifyConsistListChanged()
Notify the registered ConsistListListener objects that the ConsistList has changed.void
removeConsistListListener(ConsistListListener listener)
Remove a ConsistListListener object with this ConsistManagervoid
requestUpdateFromLayout()
Request an update from the layout, loading Consists from the command station.-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.ConsistManager
canBeDisabled, isEnabled, registerEnableListener, unregisterEnableListener
-
-
-
-
Constructor Detail
-
JsonConsistManager
public JsonConsistManager()
-
-
Method Detail
-
getConsist
public Consist getConsist(LocoAddress address)
Description copied from interface:ConsistManager
Find a Consist with this consist address, and return it. If the Consist doesn't exit, create it.- Specified by:
getConsist
in interfaceConsistManager
- Parameters:
address
- the consist address- Returns:
- an existing or new consist
-
delConsist
public void delConsist(LocoAddress address)
Description copied from interface:ConsistManager
Remove an old Consist.- Specified by:
delConsist
in interfaceConsistManager
- Parameters:
address
- the consist address
-
isCommandStationConsistPossible
public boolean isCommandStationConsistPossible()
Description copied from interface:ConsistManager
Does this implementation support Command Station Consists?- Specified by:
isCommandStationConsistPossible
in interfaceConsistManager
- Returns:
- true if command station consists are supported; false otherwise
-
csConsistNeedsSeperateAddress
public boolean csConsistNeedsSeperateAddress()
Description copied from interface:ConsistManager
Does a command station consist require a separate consist address from locomotives in consist?- Specified by:
csConsistNeedsSeperateAddress
in interfaceConsistManager
- Returns:
- true is command station consist requires separate address; false otherwise
-
getConsistList
public java.util.ArrayList<LocoAddress> getConsistList()
Description copied from interface:ConsistManager
Get a list of known consist addresses.- Specified by:
getConsistList
in interfaceConsistManager
- Returns:
- list of addresses
-
decodeErrorCode
public java.lang.String decodeErrorCode(int errorCode)
Description copied from interface:ConsistManager
Translate Error Codes relieved by a consistListener into Strings- Specified by:
decodeErrorCode
in interfaceConsistManager
- Parameters:
errorCode
- the code- Returns:
- the description
-
requestUpdateFromLayout
public void requestUpdateFromLayout()
Description copied from interface:ConsistManager
Request an update from the layout, loading Consists from the command station.- Specified by:
requestUpdateFromLayout
in interfaceConsistManager
-
addConsistListListener
public void addConsistListListener(ConsistListListener listener)
Description copied from interface:ConsistManager
Register a ConsistListListener object with this ConsistManager- Specified by:
addConsistListListener
in interfaceConsistManager
- Parameters:
listener
- a Consist List Listener object.
-
removeConsistListListener
public void removeConsistListListener(ConsistListListener listener)
Description copied from interface:ConsistManager
Remove a ConsistListListener object with this ConsistManager- Specified by:
removeConsistListListener
in interfaceConsistManager
- Parameters:
listener
- a Consist List Listener object.
-
notifyConsistListChanged
public void notifyConsistListChanged()
Description copied from interface:ConsistManager
Notify the registered ConsistListListener objects that the ConsistList has changed.- Specified by:
notifyConsistListChanged
in interfaceConsistManager
-
isConsistManager
public boolean isConsistManager()
Test if a real ConsistManager is available.- Returns:
- true if a real consist manager is available, false otherwise.
-
-