Package jmri.jmrit.symbolicprog
Class CvValue
java.lang.Object
jmri.jmrit.symbolicprog.AbstractValue
jmri.jmrit.symbolicprog.CvValue
- All Implemented Interfaces:
EventListener,ProgListener
Encapsulate a single CV value and provide programming access to the decoder.
Since this is a single CV in a single decoder, the Programmer used to get access is part of the state. This allows us to specify a specific ops-mode programmer aimed at a particular decoder.
There are three relevant parameters: Busy, Value, State. Busy == true means that a read or write operation is going on. When it transitions to "false", the operation is complete, and the Value and State are stable. During a read operation, Value changes before State, so you can assume that Value is stable if notified of a State change.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrit.symbolicprog.AbstractValue
AbstractValue.ValueState -
Field Summary
FieldsFields inherited from class jmri.jmrit.symbolicprog.AbstractValue
propFields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted -
Constructor Summary
ConstructorsConstructorDescriptionCvValue(String num, String cvName, Programmer pProgrammer) CvValue(String num, Programmer pProgrammer) -
Method Summary
Modifier and TypeMethodDescriptionvoidcvName()voiddispose()(package private) void(package private) ColorgetColor()intGet the decoder value read during compare.(package private) ColorbooleanRetrieve bean keeping track of whether this CV is intended to be used as info-only.booleanRetrieve bean keeping track of whether this CV is intended to be read-only.getState()(package private) JTextFieldintgetValue()booleanRetrieve bean keeping track of whether this CV is intended to be used as write-only.booleanisBusy()booleanisToRead()Ask whether this object needs to be read.booleanAsk whether this object needs to be written.protected voidnotifyValueChange(int value) number()voidprogrammingOpReply(int value, int retval) Receive a callback at the end of a programming operation.voidvoid(package private) voidMethod to handle color changes for states.voidsetInfoOnly(boolean is) Set bean keeping track of whether this CV is intended to be used as info-only.(package private) voidvoidsetReadOnly(boolean is) Set bean keeping track of whether this CV is intended to be read-only.voidsetState(AbstractValue.ValueState state) Set state value and send notification.Also sets GUI color as needed.voidsetToRead(boolean state) Mark whether this object needs to be read.voidsetToWrite(boolean state) Mark whether this object needs to be written.voidsetValue(int value) Edit a new value into the CV.voidsetWriteOnly(boolean is) Set bean keeping track of whether this CV is intended to be used as write-only.toString()voidMethods inherited from class jmri.jmrit.symbolicprog.AbstractValue
addPropertyChangeListener, getAvailable, removePropertyChangeListener, setAvailable
-
Field Details
-
_defaultColor
-
_tableEntry
-
-
Constructor Details
-
CvValue
-
CvValue
-
-
Method Details
-
toString
-
setProgrammer
-
number
-
cvName
-
getValue
-
getDefaultColor
-
getColor
-
notifyValueChange
-
setValue
Edit a new value into the CV. Fires listenersOnly use this for external edits, e.g. set from a GUI. Not for internal uses, as it sets the state to EDITED.
- Parameters:
value- new CV value.
-
getDecoderValue
Get the decoder value read during compare.- Returns:
- _decoderValue
-
getState
-
setState
Set state value and send notification.Also sets GUI color as needed.- Parameters:
state- new state, e.g READ, UNKNOWN, SAME.
-
isBusy
-
setColor
Description copied from class:AbstractValueMethod to handle color changes for states.- Specified by:
setColorin classAbstractValue- Parameters:
c- the desired colour
-
getTableEntry
-
setReadOnly
Set bean keeping track of whether this CV is intended to be read-only. Does not otherwise affect behaviour! Default is "false".- Parameters:
is- read-only flag, true or false.
-
getReadOnly
Retrieve bean keeping track of whether this CV is intended to be read-only. Does not otherwise affect behaviour! Default is "false".- Returns:
- read-only flag.
-
setInfoOnly
Set bean keeping track of whether this CV is intended to be used as info-only. Does not otherwise affect behaviour! Default is "false".- Parameters:
is- info-only flag, true or false.
-
getInfoOnly
Retrieve bean keeping track of whether this CV is intended to be used as info-only. Does not otherwise affect behaviour! Default is "false".- Returns:
- write-only flag.
-
setWriteOnly
Set bean keeping track of whether this CV is intended to be used as write-only. Does not otherwise affect behaviour! Default is "false".- Parameters:
is- write-only flag, true or false.
-
getWriteOnly
Retrieve bean keeping track of whether this CV is intended to be used as write-only.Does not otherwise affect behaviour! Default is "false".
- Returns:
- write-only flag.
-
setToRead
Description copied from class:AbstractValueMark whether this object needs to be read.- Overrides:
setToReadin classAbstractValue- Parameters:
state- true if the object needs to be read, false otherwise- See Also:
-
isToRead
Description copied from class:AbstractValueAsk whether this object needs to be read.- Overrides:
isToReadin classAbstractValue- Returns:
- true if the object needs to be read, false otherwise
- See Also:
-
setToWrite
Description copied from class:AbstractValueMark whether this object needs to be written.- Overrides:
setToWritein classAbstractValue- Parameters:
state- true if the object needs to be written, false otherwise- See Also:
-
isToWrite
Description copied from class:AbstractValueAsk whether this object needs to be written.- Overrides:
isToWritein classAbstractValue- Returns:
- true if the object needs to be written, false otherwise
- See Also:
-
read
-
read
-
confirm
-
write
-
programmingOpReply
Description copied from interface:ProgListenerReceive a callback at the end of a programming operation.- Specified by:
programmingOpReplyin interfaceProgListener- Parameters:
value- Value from a read operation, or value written on a writeretval- Denotes the completion code. Note that this is a bitwise combination of the various status coded defined in this interface.
-
errorTimeout
void errorTimeout() -
dispose
-