Class LongAddrVariableValue

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.FocusListener, java.beans.PropertyChangeListener, java.util.EventListener

    public class LongAddrVariableValue
    extends VariableValue
    implements java.awt.event.ActionListener, java.awt.event.FocusListener
    Extends VariableValue to represent an NMRA long address.
    • Method Detail

      • getCvDescription

        public java.lang.String getCvDescription()
        Provide a user-readable description of the CVs accessed by this variable.
        Overrides:
        getCvDescription in class VariableValue
        Returns:
        a user-readable description
      • rangeVal

        public java.lang.Object rangeVal()
        Description copied from class: VariableValue
        Gets a (usually text) description of the variable type and range.
        Specified by:
        rangeVal in class VariableValue
        Returns:
        description of the variable type and range
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        ActionListener implementations
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • focusGained

        public void focusGained​(java.awt.event.FocusEvent e)
        FocusListener implementations
        Specified by:
        focusGained in interface java.awt.event.FocusListener
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent e)
        Specified by:
        focusLost in interface java.awt.event.FocusListener
      • 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
        Parameters:
        i - the integer value to set
      • getIntValue

        public int getIntValue()
        Description copied from class: VariableValue
        Get the value as a single integer.

        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
        Returns:
        the value as an integer
      • getCommonRep

        public java.awt.Component getCommonRep()
        Description copied from class: VariableValue
        Get a display representation Object of this variable.

        The actual stored value of a variable is not the most interesting thing. Instead, you usually get an Object representation for display in a table, etc. Modification of the state of that object then gets reflected back, causing the underlying CV objects to change.
        Specified by:
        getCommonRep in class VariableValue
        Returns:
        the Object representation for display purposes
      • setValue

        public void setValue​(int value)
      • setColor

        void setColor​(java.awt.Color c)
        Description copied from class: AbstractValue
        Method to handle color changes for states.
        Specified by:
        setColor in class AbstractValue
        Parameters:
        c - the desired colour
      • getNewRep

        public java.awt.Component getNewRep​(java.lang.String format)
        Description copied from class: VariableValue
        Creates a new Object representation for display purposes, using the specified format.
        Specified by:
        getNewRep in class VariableValue
        Parameters:
        format - a name representing
        Returns:
        an Object representation for display purposes
      • setToRead

        public void setToRead​(boolean state)
        Description copied from class: VariableValue
        Mark whether this object needs to be read.

        Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

        Overrides:
        setToRead in class VariableValue
        Parameters:
        state - true if the object needs to be read, false otherwise
        See Also:
        AbstractValue
      • isToRead

        public boolean isToRead()
        Description copied from class: VariableValue
        Ask whether this object needs to be read.

        Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

        Overrides:
        isToRead in class VariableValue
        Returns:
        true if the object needs to be read, false otherwise
        See Also:
        AbstractValue
      • setToWrite

        public void setToWrite​(boolean state)
        Description copied from class: VariableValue
        Mark whether this object needs to be written.

        Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

        Overrides:
        setToWrite in class VariableValue
        Parameters:
        state - true if the object needs to be written, false otherwise
        See Also:
        AbstractValue
      • isToWrite

        public boolean isToWrite()
        Description copied from class: VariableValue
        Ask whether this object needs to be written.

        Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.

        Overrides:
        isToWrite in class VariableValue
        Returns:
        true if the object needs to be written, false otherwise
        See Also:
        AbstractValue