jmri.jmrit.symbolicprog
Class LongAddrVariableValue

java.lang.Object
  extended by jmri.jmrit.symbolicprog.AbstractValue
      extended by jmri.jmrit.symbolicprog.VariableValue
          extended by jmri.jmrit.symbolicprog.LongAddrVariableValue
All Implemented Interfaces:
ActionListener, FocusListener, PropertyChangeListener, EventListener

public class LongAddrVariableValue
extends VariableValue
implements ActionListener, PropertyChangeListener, FocusListener

Extends VariableValue to represent a NMRA long address

Author:
Bob Jacobsen Copyright (C) 2001, 2002

Nested Class Summary
 class LongAddrVariableValue.VarTextField
           
 
Field Summary
 
Fields inherited from class jmri.jmrit.symbolicprog.VariableValue
_cvVector, _status, _tooltipText
 
Fields inherited from class jmri.jmrit.symbolicprog.AbstractValue
DIFF, EDITED, FROMFILE, READ, SAME, STORED, UNKNOWN
 
Constructor Summary
LongAddrVariableValue(String name, String comment, String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, int cvNum, String mask, int minVal, int maxVal, Vector<CvValue> v, JLabel status, String stdname)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
          ActionListener implementations
 void dispose()
           
 void focusGained(FocusEvent e)
          FocusListener implementations
 void focusLost(FocusEvent e)
           
 Component getCommonRep()
           
 int getIntValue()
          Get the value as a single number.
 Component getNewRep(String format)
           
 Object getValueObject()
           
 String getValueString()
           
 boolean isChanged()
          Determine whether this Variable is "changed", so that "read changes" and "write changes" will act on it.
 boolean isToRead()
          Simple implementation for the case of a single CV.
 boolean isToWrite()
          Simple implementation for the case of a single CV.
 void propertyChange(PropertyChangeEvent e)
           
 Object rangeVal()
           
 void readAll()
          Always read the contents of this Variable
 void readChanges()
          Read the contents of this Variable if it's in a state that indicates it was "changed"
 void setCvState(int state)
          Notify the connected CVs of a state change from above
 void setIntValue(int i)
          Set the value from a single number.
 void setToolTipText(String t)
          Set tooltip text to be used by both the "value" and representations of this Variable.
 void setToRead(boolean state)
          Simple implementation for the case of a single CV.
 void setToWrite(boolean state)
          Simple implementation for the case of a single CV.
 void setValue(int value)
           
 CvValue[] usesCVs()
          Provide access to CVs referenced by this operation
 void writeAll()
          Always write the contents of this Variable
 void writeChanges()
          Write the contents of this Variable if it's in a state that indicates it was "changed"
 
Methods inherited from class jmri.jmrit.symbolicprog.VariableValue
confirmAll, considerChanged, cvName, getComment, getCvNum, getInfoOnly, getMask, getOpsOnly, getReadOnly, getState, getTextValue, getWriteOnly, isBusy, item, label, maskVal, newValue, offsetVal, setBusy, setState, updateRepresentation
 
Methods inherited from class jmri.jmrit.symbolicprog.AbstractValue
addPropertyChangeListener, getAvailable, removePropertyChangeListener, setAvailable, stateNameFromValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongAddrVariableValue

public LongAddrVariableValue(String name,
                             String comment,
                             String cvName,
                             boolean readOnly,
                             boolean infoOnly,
                             boolean writeOnly,
                             boolean opsOnly,
                             int cvNum,
                             String mask,
                             int minVal,
                             int maxVal,
                             Vector<CvValue> v,
                             JLabel status,
                             String stdname)
Method Detail

usesCVs

public CvValue[] usesCVs()
Description copied from class: VariableValue
Provide access to CVs referenced by this operation

Specified by:
usesCVs in class VariableValue

setToolTipText

public void setToolTipText(String t)
Description copied from class: VariableValue
Set tooltip text to be used by both the "value" and representations of this Variable.

This is expected to be overridden in subclasses to change their internal info.

Overrides:
setToolTipText in class VariableValue
See Also:
VariableValue.updateRepresentation(javax.swing.JComponent)

rangeVal

public Object rangeVal()
Specified by:
rangeVal in class VariableValue

actionPerformed

public void actionPerformed(ActionEvent e)
ActionListener implementations

Specified by:
actionPerformed in interface ActionListener

focusGained

public void focusGained(FocusEvent e)
FocusListener implementations

Specified by:
focusGained in interface FocusListener

focusLost

public void focusLost(FocusEvent e)
Specified by:
focusLost in interface FocusListener

getValueString

public String getValueString()
Specified by:
getValueString in class VariableValue
Returns:
String that can (usually) be interpreted as an integer

setIntValue

public void setIntValue(int i)
Description copied from class: VariableValue
Set the value from a single number. In some cases, e.g. speed tables, this will result in complex behavior, where setIntValue(getIntValue()) results in something unexpected.

Specified by:
setIntValue in class VariableValue

getIntValue

public int getIntValue()
Description copied from class: VariableValue
Get the value as a single number. In some cases, e.g. speed tables, this will result in complex behavior, where setIntValue(getIntValue()) results in something unexpected.

Specified by:
getIntValue in class VariableValue

getValueObject

public Object getValueObject()
Specified by:
getValueObject in class VariableValue
Returns:
Value as a native-form Object

getCommonRep

public Component getCommonRep()
Specified by:
getCommonRep in class VariableValue

setValue

public void setValue(int value)

getNewRep

public Component getNewRep(String format)
Specified by:
getNewRep in class VariableValue

setCvState

public void setCvState(int state)
Notify the connected CVs of a state change from above

Specified by:
setCvState in class VariableValue
Parameters:
state -

isChanged

public boolean isChanged()
Description copied from class: VariableValue
Determine whether this Variable is "changed", so that "read changes" and "write changes" will act on it.

Specified by:
isChanged in class VariableValue
See Also:
VariableValue.considerChanged(jmri.jmrit.symbolicprog.CvValue)

setToRead

public void setToRead(boolean state)
Description copied from class: VariableValue
Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

Overrides:
setToRead in class VariableValue

isToRead

public boolean isToRead()
Description copied from class: VariableValue
Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

Overrides:
isToRead in class VariableValue

setToWrite

public void setToWrite(boolean state)
Description copied from class: VariableValue
Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

Overrides:
setToWrite in class VariableValue

isToWrite

public boolean isToWrite()
Description copied from class: VariableValue
Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

Overrides:
isToWrite in class VariableValue

readChanges

public void readChanges()
Description copied from class: VariableValue
Read the contents of this Variable if it's in a state that indicates it was "changed"

Specified by:
readChanges in class VariableValue
See Also:
VariableValue.isChanged()

writeChanges

public void writeChanges()
Description copied from class: VariableValue
Write the contents of this Variable if it's in a state that indicates it was "changed"

Specified by:
writeChanges in class VariableValue
See Also:
VariableValue.isChanged()

readAll

public void readAll()
Description copied from class: VariableValue
Always read the contents of this Variable

Specified by:
readAll in class VariableValue

writeAll

public void writeAll()
Description copied from class: VariableValue
Always write the contents of this Variable

Specified by:
writeAll in class VariableValue

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener
Specified by:
propertyChange in class VariableValue

dispose

public void dispose()
Specified by:
dispose in class VariableValue


Copyright © 1997 - 2011 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: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads