jmri.jmrit.symbolicprog
Class DecVariableValue

Show UML class diagram
java.lang.Object
  extended by jmri.jmrit.symbolicprog.AbstractValue
      extended by jmri.jmrit.symbolicprog.VariableValue
          extended by jmri.jmrit.symbolicprog.DecVariableValue
All Implemented Interfaces:
ActionListener, FocusListener, PropertyChangeListener, EventListener
Direct Known Subclasses:
HexVariableValue, ShortAddrVariableValue

public class DecVariableValue
extends VariableValue
implements ActionListener, PropertyChangeListener, FocusListener

Decimal representation of a value.


Nested Class Summary
 class DecVariableValue.VarTextField
           
 
Field Summary
(package private)  Color _defaultColor
           
(package private)  int _maxVal
           
(package private)  int _minVal
           
(package private)  JTextField _value
           
(package private) static org.slf4j.Logger log
           
(package private)  String oldContents
           
(package private)  List<Component> reps
           
(package private)  ArrayList<DecVarSlider> sliders
           
 
Fields inherited from class jmri.jmrit.symbolicprog.VariableValue
_cvMap, _status, _tooltipText
 
Fields inherited from class jmri.jmrit.symbolicprog.AbstractValue
COLOR_DIFF, COLOR_EDITED, COLOR_FROMFILE, COLOR_READ, COLOR_SAME, COLOR_STORED, COLOR_UNKNOWN, DIFF, EDITED, FROMFILE, prop, READ, SAME, STORED, UNKNOWN
 
Constructor Summary
DecVariableValue(String name, String comment, String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String cvNum, String mask, int minVal, int maxVal, HashMap<String,CvValue> v, JLabel status, String stdname)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
          ActionListener implementations
 void dispose()
           
(package private)  void enterField()
           
(package private)  void exitField()
           
 void focusGained(FocusEvent e)
          FocusListener implementations
 void focusLost(FocusEvent e)
           
(package private)  Color getColor()
           
 Component getCommonRep()
           
(package private)  Color getDefaultColor()
           
 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.
 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 setAvailable(boolean a)
           
(package private)  void setColor(Color c)
           
 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 setValue(int value)
          Set a new value, including notification as needed.
(package private)  void updatedTextField()
          Invoked when a permanent change to the JTextField has been made.
 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, getCvDescription, getCvName, getCvNum, getInfoOnly, getMask, getOpsOnly, getReadOnly, getState, getTextValue, getWriteOnly, isBusy, isToRead, isToWrite, item, label, maskVal, newValue, offsetVal, setBusy, setState, setToRead, setToWrite, updateRepresentation
 
Methods inherited from class jmri.jmrit.symbolicprog.AbstractValue
addPropertyChangeListener, getAvailable, removePropertyChangeListener, stateNameFromValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_maxVal

int _maxVal

_minVal

int _minVal

oldContents

String oldContents

reps

List<Component> reps

sliders

ArrayList<DecVarSlider> sliders

_defaultColor

Color _defaultColor

_value

JTextField _value

log

static org.slf4j.Logger log
Constructor Detail

DecVariableValue

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

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)

usesCVs

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

Specified by:
usesCVs in class VariableValue

rangeVal

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

enterField

void enterField()

exitField

void exitField()

updatedTextField

void updatedTextField()
Invoked when a permanent change to the JTextField has been made. Note that this does _not_ notify property listeners; that should be done by the invoker, who may or may not know what the old value was. Can be overwridden in subclasses that want to display the value differently.

Overrides:
updatedTextField 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

setAvailable

public void setAvailable(boolean a)
Overrides:
setAvailable in class AbstractValue

getNewRep

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

setValue

public void setValue(int value)
Set a new value, including notification as needed. This does the conversion from string to int, so if the place where formatting needs to be applied


getDefaultColor

Color getDefaultColor()

getColor

Color getColor()

setColor

void setColor(Color c)
Specified by:
setColor in class AbstractValue

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)

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-2014 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