Package jmri.managers
Class AbstractPowerManager<M extends SystemConnectionMemo>
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.managers.AbstractPowerManager<M>
-
- Type Parameters:
M
- the type of SystemConnectionMemo supported by this PowerManager
- All Implemented Interfaces:
PropertyChangeFirer
,PropertyChangeProvider
,PowerManager
- Direct Known Subclasses:
CbusPowerManager
,DCCppPowerManager
,DefaultPowerManager
,EasyDccPowerManager
,EcosPowerManager
,JMRIClientPowerManager
,LnPowerManager
,MarklinPowerManager
,MqttPowerManager
,MrcPowerManager
,Mx1PowerManager
,NcePowerManager
,SprogPowerManager
,SRCPPowerManager
,TamsPowerManager
,XNetPowerManager
,XpaPowerManager
public abstract class AbstractPowerManager<M extends SystemConnectionMemo> extends PropertyChangeSupport implements PowerManager
Base PowerManager implementation for controlling layout power.These are registered when they are added to the InstanceManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractPowerManager.TimeKeeper
-
Field Summary
Fields Modifier and Type Field Description protected M
memo
protected int
power
Note that all changes must fire a property change with the old and new values-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description AbstractPowerManager(M memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
firePowerPropertyChange(int old, int current)
Fires aPropertyChangeEvent
for the power state using property name "power".int
getPower()
java.lang.String
getUserName()
void
setPower(int state)
long
timeSinceLastPowerOn()
Returns the amount of time since the layout was last powered up, in milliseconds.-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.PowerManager
dispose, implementsIdle
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
memo
protected final M extends SystemConnectionMemo memo
-
power
protected int power
Note that all changes must fire a property change with the old and new values
-
-
Constructor Detail
-
AbstractPowerManager
public AbstractPowerManager(M memo)
-
-
Method Detail
-
getPower
public int getPower()
- Specified by:
getPower
in interfacePowerManager
-
setPower
public void setPower(int state) throws JmriException
- Specified by:
setPower
in interfacePowerManager
- Throws:
JmriException
-
getUserName
public final java.lang.String getUserName()
- Specified by:
getUserName
in interfacePowerManager
-
timeSinceLastPowerOn
public long timeSinceLastPowerOn()
Returns the amount of time since the layout was last powered up, in milliseconds. If the layout has not been powered up as far as JMRI knows it returns a very long time indeed.- Returns:
- long int
-
firePowerPropertyChange
protected final void firePowerPropertyChange(int old, int current)
Fires aPropertyChangeEvent
for the power state using property name "power".- Parameters:
old
- the old power statecurrent
- the new power state
-
-