|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.symbolicprog.AbstractValue
jmri.jmrit.symbolicprog.VariableValue
jmri.jmrit.symbolicprog.SpeedTableVarValue
public class SpeedTableVarValue
Represent an entire speed table as a single Variable.
This presents as a set of vertically oriented sliders, with numeric values above them. That it turn is done using VarSlider and DecVariableValue objects respectively. VarSlider is an interior class to color a JSlider by state. The respective VarSlider and DecVariableValue communicate through their underlying CV objects. Changes to CV Values are listened to by this class, which updates the model objects for the VarSliders; the DecVariableValues listen directly.
Color (hence state) of individual sliders (hence CVs) are directly coupled to the state of those CVs.
The state of the entire variable has to be a composite of all the sliders, hence CVs. The mapping is (in order):
A similar pattern is used for a read or write request. Write writes them all; Read reads any that aren't READ or WRITTEN.
Speed tables can have different numbers of entries; 28 is the default, and also the maximum.
The NMRA specification says that speed table entries cannot be non-monotonic (e.g. cannot decrease when moving from lower to higher CV numbers). In earlier versions of the code, this was enforced any time a value was changed (for any reason). This caused a problem when CVs were read that were non-monotonic: That value was read, causing lower CVs to be made consistent, a change in their value which changed their state, so they were read again. To avoid this, the class now only enforces non-monotonicity when the slider is adjusted.
_value is a holdover from the LongAddrVariableValue, which this was copied from; it should be removed.
| Nested Class Summary | |
|---|---|
class |
SpeedTableVarValue.VarSlider
|
| 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 | |
|---|---|
SpeedTableVarValue()
Create a null object. |
|
SpeedTableVarValue(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,
int entries)
Create the object with a "standard format ctor". |
|
| Method Summary | |
|---|---|
void |
dispose()
|
Component |
getCommonRep()
|
int |
getIntValue()
Get the value as a single number. |
Component |
getNewRep(String format)
|
int |
getState()
|
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 |
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 |
setValue(int value)
|
void |
stateChanged(ChangeEvent e)
Called for new values of a slider. |
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, getTextValue, getWriteOnly, isBusy, isToRead, isToWrite, item, label, maskVal, newValue, offsetVal, setBusy, setState, setToolTipText, setToRead, setToWrite, 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 |
|---|
public SpeedTableVarValue(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,
int entries)
public SpeedTableVarValue()
| Method Detail |
|---|
public Object rangeVal()
rangeVal in class VariableValuepublic CvValue[] usesCVs()
VariableValue
usesCVs in class VariableValuepublic void stateChanged(ChangeEvent e)
Sets the CV(s) as needed.
stateChanged in interface ChangeListenere - public int getState()
getState in class VariableValuepublic String getValueString()
getValueString in class VariableValuepublic void setIntValue(int i)
VariableValue
setIntValue in class VariableValuepublic int getIntValue()
VariableValue
getIntValue in class VariableValuepublic Object getValueObject()
getValueObject in class VariableValuepublic Component getCommonRep()
getCommonRep in class VariableValuepublic void setValue(int value)
public Component getNewRep(String format)
getNewRep in class VariableValuepublic void setCvState(int state)
setCvState in class VariableValuestate - public boolean isChanged()
VariableValue
isChanged in class VariableValueVariableValue.considerChanged(jmri.jmrit.symbolicprog.CvValue)public void readChanges()
VariableValue
readChanges in class VariableValueVariableValue.isChanged()public void writeChanges()
VariableValue
writeChanges in class VariableValueVariableValue.isChanged()public void readAll()
VariableValue
readAll in class VariableValuepublic void writeAll()
VariableValue
writeAll in class VariableValuepublic void propertyChange(PropertyChangeEvent e)
propertyChange in interface PropertyChangeListenerpropertyChange in class VariableValuepublic void dispose()
dispose in class VariableValue
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||