Class ConstantValue
- All Implemented Interfaces:
PropertyChangeListener,EventListener
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrit.symbolicprog.AbstractValue
AbstractValue.ValueState -
Field Summary
FieldsModifier and TypeFieldDescription(package private) Color(package private) String[](package private) int(package private) List<JRadioButton>Fields inherited from class jmri.jmrit.symbolicprog.VariableValue
_cvMap, _status, _tooltipTextFields inherited from class jmri.jmrit.symbolicprog.AbstractValue
prop -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Dispose of the object.Get a display representationObjectof this variable.Provide a user-readable description of the CVs accessed by this variable.intGet the value as a single integer.Creates a newObjectrepresentation for display purposes, using the specified format.booleanDetermine whether this Variable is "changed", so that "read changes" and "write changes" will act on it.booleanisToRead()Ask whether this object needs to be read.booleanAsk whether this object needs to be written.voidrangeVal()Gets a (usually text) description of the variable type and range.voidreadAll()Skip actually reading, but set states and notifications anyway.voidRead the contents of this Variable if it's in a state that indicates it was "changed".(package private) voidMethod to handle color changes for states.voidNo connected CV, so this notify does nothingvoidsetIntValue(int i) Set the value from a single number.voidSet tooltip text to be used by both the "value" and representations of this Variable.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) CvValue[]usesCVs()Provide access to CVs used by this Variable.voidwriteAll()Skip actually writing, but set states and notifications anyway.voidWrite 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, getCvName, getCvNum, getInfoOnly, getLongValue, getMask, getMaxMask, getOpsOnly, getReadOnly, getState, getTextValue, getValueInCV, getWriteOnly, isBitMask, isBusy, item, label, maskValAsInt, offsetVal, setBusy, setState, setValue, setValueInCV, simplifyMask, updatedTextField, updateRepresentationMethods inherited from class jmri.jmrit.symbolicprog.AbstractValue
addPropertyChangeListener, getAvailable, removePropertyChangeListener, setAvailable
-
Field Details
-
_value
-
_itemArray
-
_nstored
int _nstored -
_defaultColor
-
comboCBs
-
comboRBs
-
-
Constructor Details
-
ConstantValue
-
ConstantValue
public ConstantValue()Create a null object. Normally only used for tests and to pre-load classes.
-
-
Method Details
-
usesCVs
Description copied from class:VariableValueProvide access to CVs used by this Variable.- Specified by:
usesCVsin classVariableValue- Returns:
- an array of CVs used by this Variable
-
getCvDescription
Provide a user-readable description of the CVs accessed by this variable.- Overrides:
getCvDescriptionin classVariableValue- Returns:
- a user-readable description
-
setToolTipText
Description copied from class:VariableValueSet 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:
setToolTipTextin classVariableValue- Parameters:
t- the tooltip text to be used- See Also:
-
rangeVal
Description copied from class:VariableValueGets a (usually text) description of the variable type and range.- Specified by:
rangeValin classVariableValue- Returns:
- description of the variable type and range
-
getValueString
- Specified by:
getValueStringin classVariableValue- Returns:
- String that can (usually) be interpreted as an integer
-
setIntValue
Description copied from class:VariableValueSet 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:
setIntValuein classVariableValue- Parameters:
i- the integer value to set
-
getIntValue
Description copied from class:VariableValueGet 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:
getIntValuein classVariableValue- Returns:
- the value as an integer
-
getValueObject
- Specified by:
getValueObjectin classVariableValue- Returns:
- Value as a native-form Object
-
getCommonRep
Description copied from class:VariableValueGet a display representationObjectof this variable.
The actual stored value of a variable is not the most interesting thing. Instead, you usually get anObjectrepresentation 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:
getCommonRepin classVariableValue- Returns:
- the
Objectrepresentation for display purposes
-
setValue
-
getNewRep
Description copied from class:VariableValueCreates a newObjectrepresentation for display purposes, using the specified format.- Specified by:
getNewRepin classVariableValue- Parameters:
format- a name representing- Returns:
- an
Objectrepresentation for display purposes
-
setColor
Description copied from class:AbstractValueMethod to handle color changes for states.- Specified by:
setColorin classAbstractValue- Parameters:
c- the desired colour
-
setCvState
No connected CV, so this notify does nothing- Specified by:
setCvStatein classVariableValue- Parameters:
state- the new state to set
-
isChanged
Description copied from class:VariableValueDetermine whether this Variable is "changed", so that "read changes" and "write changes" will act on it.- Specified by:
isChangedin classVariableValue- Returns:
- true if Variable is "changed"
- See Also:
-
setToRead
Description copied from class:VariableValueMark whether this object needs to be read.Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.
- Overrides:
setToReadin classVariableValue- Parameters:
state- true if the object needs to be read, false otherwise- See Also:
-
isToRead
Description copied from class:VariableValueAsk whether this object needs to be read.Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.
- Overrides:
isToReadin classVariableValue- Returns:
- true if the object needs to be read, false otherwise
- See Also:
-
setToWrite
Description copied from class:VariableValueMark whether this object needs to be written.Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.
- Overrides:
setToWritein classVariableValue- Parameters:
state- true if the object needs to be written, false otherwise- See Also:
-
isToWrite
Description copied from class:VariableValueAsk whether this object needs to be written.Simple implementation for the case of a single CV. Intended to be sufficient for many subclasses.
- Overrides:
isToWritein classVariableValue- Returns:
- true if the object needs to be written, false otherwise
- See Also:
-
readChanges
Description copied from class:VariableValueRead the contents of this Variable if it's in a state that indicates it was "changed".- Specified by:
readChangesin classVariableValue- See Also:
-
writeChanges
Description copied from class:VariableValueWrite the contents of this Variable if it's in a state that indicates it was "changed".- Specified by:
writeChangesin classVariableValue- See Also:
-
readAll
Skip actually reading, but set states and notifications anyway.This sets the state to READ so that you can have algorithms like "write all variables that aren't in READ state" This is different from the 'normal' VariableValue objects, which rely on the associated CV objects to drive state changes at the end of the write.
- Specified by:
readAllin classVariableValue
-
writeAll
Skip actually writing, but set states and notifications anyway.This sets the state to STORED so that you can have algorithms like "write all variables that aren't in STORED state" This is different from the 'normal' VariableValue objects, which rely on the associated CV objects to drive state changes at the end of the write.
- Specified by:
writeAllin classVariableValue
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener- Specified by:
propertyChangein classVariableValue
-
dispose
Description copied from class:VariableValueDispose of the object.- Specified by:
disposein classVariableValue
-