jmri.jmrit.symbolicprog
Class CvValue

java.lang.Object
  extended by jmri.jmrit.symbolicprog.AbstractValue
      extended by jmri.jmrit.symbolicprog.CvValue
All Implemented Interfaces:
EventListener, ProgListener

public class CvValue
extends AbstractValue
implements 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.

Author:
Bob Jacobsen Copyright (C) 2001, 2003, 2004, Howard G. Penny Copyright (C) 2005

Field Summary
 
Fields inherited from class jmri.jmrit.symbolicprog.AbstractValue
DIFF, EDITED, FROMFILE, READ, SAME, STORED, UNKNOWN
 
Fields inherited from interface jmri.ProgListener
ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, UnknownError, UserAborted
 
Constructor Summary
CvValue(int num, Programmer pProgrammer)
           
CvValue(int num, String cvName, int piCv, int piVal, int siCv, int siVal, int iCv, Programmer pProgrammer)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener p)
           
 void confirm(JLabel status)
           
 void confirmIcV(JLabel status)
           
 String cvName()
           
 void dispose()
           
 int getDecoderValue()
          Get the decoder value read during compare
 boolean getInfoOnly()
          Retrieve bean keeping track of whether this CV is intended to be used as info-only.
 boolean getReadOnly()
          Retrieve bean keeping track of whether this CV is intended to be read-only.
 int getState()
           
 int getValue()
           
 boolean getWriteOnly()
          Retrieve bean keeping track of whether this CV is intended to be used as write-only.
 int iCv()
           
 boolean isBusy()
           
 boolean isToRead()
           
 boolean isToWrite()
           
protected  void notifyValueChange(int value)
           
 int number()
           
 int piCv()
           
 int piVal()
           
 void programmingOpReply(int value, int retval)
          Receive a callback at the end of a programming operation.
 void read(JLabel status)
           
 void readIcV(JLabel status)
           
 void removePropertyChangeListener(PropertyChangeListener p)
           
 void setInfoOnly(boolean is)
          Set bean keeping track of whether this CV is intended to be used as info-only.
 void setReadOnly(boolean is)
          Set bean keeping track of whether this CV is intended to be read-only.
 void setState(int state)
          Set state value and send notification.
 void setToRead(boolean state)
           
 void setToWrite(boolean state)
           
 void setValue(int value)
          Edit a new value into the CV.
 void setWriteOnly(boolean is)
          Set bean keeping track of whether this CV is intended to be used as write-only.
 int siCv()
           
 int siVal()
           
 String toString()
           
 void write(JLabel status)
           
 void writeIcV(JLabel status)
           
 void writePI(JLabel status)
           
 void writeSI(JLabel status)
           
 
Methods inherited from class jmri.jmrit.symbolicprog.AbstractValue
stateNameFromValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CvValue

public CvValue(int num,
               Programmer pProgrammer)

CvValue

public CvValue(int num,
               String cvName,
               int piCv,
               int piVal,
               int siCv,
               int siVal,
               int iCv,
               Programmer pProgrammer)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

number

public int number()

cvName

public String cvName()

piCv

public int piCv()

piVal

public int piVal()

siCv

public int siCv()

siVal

public int siVal()

iCv

public int iCv()

getValue

public int getValue()

notifyValueChange

protected void notifyValueChange(int value)

setValue

public void setValue(int value)
Edit a new value into the CV. Only use this for external edits, e.g. set form a GUI, not for internal uses, as it sets the state to EDITED


getDecoderValue

public int getDecoderValue()
Get the decoder value read during compare

Returns:
_decoderValue

getState

public int getState()

setState

public void setState(int state)
Set state value and send notification. Also sets GUI color as needed.


isBusy

public boolean isBusy()

setReadOnly

public void setReadOnly(boolean is)
Set bean keeping track of whether this CV is intended to be read-only. Does not otherwise affect behaviour! Default is "false".


getReadOnly

public boolean getReadOnly()
Retrieve bean keeping track of whether this CV is intended to be read-only. Does not otherwise affect behaviour! Default is "false".


setInfoOnly

public void setInfoOnly(boolean is)
Set bean keeping track of whether this CV is intended to be used as info-only. Does not otherwise affect behaviour! Default is "false".


getInfoOnly

public boolean 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".


setWriteOnly

public void setWriteOnly(boolean is)
Set bean keeping track of whether this CV is intended to be used as write-only. Does not otherwise affect behaviour! Default is "false".


getWriteOnly

public boolean 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".


setToRead

public void setToRead(boolean state)
Overrides:
setToRead in class AbstractValue

isToRead

public boolean isToRead()
Overrides:
isToRead in class AbstractValue

setToWrite

public void setToWrite(boolean state)
Overrides:
setToWrite in class AbstractValue

isToWrite

public boolean isToWrite()
Overrides:
isToWrite in class AbstractValue

read

public void read(JLabel status)

readIcV

public void readIcV(JLabel status)

confirmIcV

public void confirmIcV(JLabel status)

confirm

public void confirm(JLabel status)

write

public void write(JLabel status)

writePI

public void writePI(JLabel status)

writeSI

public void writeSI(JLabel status)

writeIcV

public void writeIcV(JLabel status)

programmingOpReply

public void programmingOpReply(int value,
                               int retval)
Description copied from interface: ProgListener
Receive a callback at the end of a programming operation.

Specified by:
programmingOpReply in interface ProgListener
Parameters:
value - Value from a read operation, or value written on a write
retval - Denotes the completion code. Note that this is a bitwise combination of the various status coded defined in this interface.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener p)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener p)

dispose

public void dispose()


Copyright © 1997 - 2008 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: SourceForge_Logo