Package jmri.jmrix.openlcb
Class OlcbLight
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractLight
-
- jmri.jmrix.openlcb.OlcbLight
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>,PropertyChangeProvider,DigitalIO,Light,NamedBean
public final class OlcbLight extends AbstractLight
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) OlcbAddressaddrOff(package private) OlcbAddressaddrOn(package private) static booleanDEFAULT_IS_AUTHORITATIVE(package private) static booleanDEFAULT_LISTEN(package private) VersionedValueListener<java.lang.Boolean>lightListener(package private) BitProducerConsumerpc-
Fields inherited from class jmri.implementation.AbstractLight
lightControlList, mActive, mCurrentIntensity, mEnabled, mMaxIntensity, mMinIntensity, mState
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.Light
FAST_CLOCK_CONTROL, INTERMEDIATE, NO_CONTROL, PROPERTY_TARGET_INTENSITY, SENSOR_CONTROL, TIMED_ON_CONTROL, TRANSITIONING, TRANSITIONINGHIGHER, TRANSITIONINGLOWER, TRANSITIONINGTOFULLOFF, TRANSITIONINGTOFULLON, TURNOUT_STATUS_CONTROL, TWO_SENSOR_CONTROL
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description OlcbLight(java.lang.String prefix, java.lang.String address, CanSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateLight()Activate a light activating all its LightControl objects.voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.protected voiddoNewState(int oldState, int newState)Set the current state of this Light This routine requests the hardware to change to newState.(package private) voidfinishLoad()Helper function that will be invoked after construction once the properties have been loaded.java.lang.StringgetRecommendedToolTip()Get a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table.voidsetProperty(java.lang.String key, java.lang.Object value)Attach a key/value pair to the NamedBean, which can be retrieved later.voidsetState(int newState)Handle a request for a state change.-
Methods inherited from class jmri.implementation.AbstractLight
addLightControl, clearLightControls, deactivateLight, describeState, getBeanType, getEnabled, getLightControlList, getState, getUsageReport, notifyStateChange, notifyTargetIntensityChange, setEnabled
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.Light
getCommandedState, getKnownState, isConsistentState, requestUpdateFromLayout, setCommandedState
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, removeProperty, setComment, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
DEFAULT_IS_AUTHORITATIVE
static final boolean DEFAULT_IS_AUTHORITATIVE
- See Also:
- Constant Field Values
-
DEFAULT_LISTEN
static final boolean DEFAULT_LISTEN
- See Also:
- Constant Field Values
-
addrOn
OlcbAddress addrOn
-
addrOff
OlcbAddress addrOff
-
lightListener
VersionedValueListener<java.lang.Boolean> lightListener
-
-
Constructor Detail
-
OlcbLight
public OlcbLight(java.lang.String prefix, java.lang.String address, CanSystemConnectionMemo memo)
-
-
Method Detail
-
finishLoad
void finishLoad()
Helper function that will be invoked after construction once the properties have been loaded. Used specifically for preventing double initialization when loading lights from XML.
-
getRecommendedToolTip
@CheckReturnValue @Nonnull public java.lang.String getRecommendedToolTip()
Description copied from interface:NamedBeanGet a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table. By default, this is the comment from the NamedBean, on the theory that the system name and/or user name are being displayed directly. Specific system implementations may override that.- Returns:
- empty String if no recommendation.
-
activateLight
public void activateLight()
Activate a light activating all its LightControl objects.- Specified by:
activateLightin interfaceLight- Overrides:
activateLightin classAbstractLight
-
setState
public void setState(int newState)
Handle a request for a state change. For these lights, ON and OFF just transition immediately between MinIntensity and MaxIntensity. Ignores any outputDelay setting for connection.
-
doNewState
protected void doNewState(int oldState, int newState)
Set the current state of this Light This routine requests the hardware to change to newState.- Overrides:
doNewStatein classAbstractLight- Parameters:
oldState- old statenewState- new state
-
setProperty
public void setProperty(@Nonnull java.lang.String key, java.lang.Object value)
Attach a key/value pair to the NamedBean, which can be retrieved later. These are not bound properties as yet, and don't throw events on modification. Key must not be null.The key is constrained to String to make these behave like normal Java Beans.
- Specified by:
setPropertyin interfaceNamedBean- Overrides:
setPropertyin classAbstractNamedBean- Parameters:
key- the property to setvalue- the value of the property
-
dispose
public void dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.
- Specified by:
disposein interfaceNamedBean- Overrides:
disposein classAbstractNamedBean
-
-