Package jmri.jmrit.symbolicprog
Class SplitTextVariableValue
java.lang.Object
jmri.jmrit.symbolicprog.AbstractValue
jmri.jmrit.symbolicprog.VariableValue
jmri.jmrit.symbolicprog.SplitVariableValue
jmri.jmrit.symbolicprog.SplitTextVariableValue
- All Implemented Interfaces:
ActionListener
,FocusListener
,PropertyChangeListener
,EventListener
public class SplitTextVariableValue extends SplitVariableValue
Like
Most attributes of
Specific attributes for this class are:
SplitVariableValue
, except that the string representation is
text.
Most attributes of
SplitVariableValue
are inherited.
Specific attributes for this class are:
-
A
match
attribute (which must be aregular expression
) can be used to impose constraints on entered text. -
A
termByteStr
attribute can be used to change the default string terminator byte value. Valid values are 0-255 or "" to specify no terminator byte. The default is "0" (a null byte). -
A
padByteStr
attribute can be used to change the default string padding byte value. Valid values are 0-255 or "" to specify no pad byte. The default is "0" (a null byte). -
A
charSet
attribute can be used to change the character set used to encode or decode the text string. Valid values are any Java-supportedCharset
name. If not specified, the default character set of this Java virtual machine is used.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrit.symbolicprog.SplitVariableValue
SplitVariableValue.CvItem, SplitVariableValue.VarTextField
-
Field Summary
Fields Modifier and Type Field Description (package private) int
atest
(package private) String
charSet
(package private) String
matchRegex
static String
NO_PAD_BYTE
static String
NO_TERM_BYTE
(package private) String
padByteStr
(package private) Byte
padByteVal
(package private) String
termByteStr
(package private) Byte
termByteVal
Fields inherited from class jmri.jmrit.symbolicprog.SplitVariableValue
_columns, _cvNum, _defaultColor, _fieldShrink, _mask, _maskArray, _maxVal, _minVal, _name, _textField, _uppermask, currentOffset, cvCount, cvList, mFactor, mOffset, mSecondCV, oldContents, reps
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
Constructors Constructor Description SplitTextVariableValue(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, String pSecondCV, int pFactor, int pOffset, String uppermask, String extra1, String extra2, String extra3, String extra4)
-
Method Summary
Modifier and Type Method Description void
actionPerformed(ActionEvent e)
Contains byte-value specific code.(package private) void
exitField()
Contains byte-value specific code.(package private) byte[]
getBytesFromText(String s)
(package private) int[]
getCvValsFromTextField()
int
getIntValue()
Get the value as a single integer.long
getLongValue()
Get the value as an unsigned long.(package private) String
getTextFromBytes(byte[] v)
(package private) boolean
isMatched(String s)
void
setIntValue(int i)
Set the value from a single number.void
setLongValue(long i)
void
setValue(String value)
Set value from a String value.void
stepOneActions(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, String pSecondCV, int pFactor, int pOffset, String uppermask, String extra1, String extra2, String extra3, String extra4)
Subclasses can override this to pick up constructor-specific attributes and perform other actions before cvList has been built.void
stepTwoActions()
Subclasses can override this to invoke further actions after cvList has been built.(package private) void
unsupportedCharset()
(package private) void
updateVariableValue(int[] intVals)
Contains byte-value specific code.Methods inherited from class jmri.jmrit.symbolicprog.SplitVariableValue
dispose, enterField, focusGained, focusLost, getCommonRep, getCvDescription, getCvNum, getMask, getMask, getNewRep, getSecondCvNum, getTextFromValue, getValueFromText, getValueObject, getValueString, isChanged, isToRead, isToWrite, priorityValue, propertyChange, rangeVal, readAll, readChanges, setAvailable, setColor, setCvState, setToolTipText, updatedTextField, usesCVs, writeAll, writeChanges
Methods inherited from class jmri.jmrit.symbolicprog.VariableValue
confirmAll, considerChanged, cvName, getComment, getCvName, getInfoOnly, getOpsOnly, getReadOnly, getState, getTextValue, getValueInCV, getWriteOnly, isBitMask, isBusy, item, label, maskValAsInt, offsetVal, setBusy, setState, setToRead, setToWrite, setValueInCV, simplifyMask, updateRepresentation
Methods inherited from class jmri.jmrit.symbolicprog.AbstractValue
addPropertyChangeListener, getAvailable, removePropertyChangeListener, stateColorFromValue, stateNameFromValue
-
Field Details
-
NO_TERM_BYTE
- See Also:
- Constant Field Values
-
NO_PAD_BYTE
- See Also:
- Constant Field Values
-
matchRegex
-
termByteStr
-
padByteStr
-
charSet
-
termByteVal
-
padByteVal
-
atest
int atest
-
-
Constructor Details
-
SplitTextVariableValue
public SplitTextVariableValue(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, String pSecondCV, int pFactor, int pOffset, String uppermask, String extra1, String extra2, String extra3, String extra4)
-
-
Method Details
-
stepOneActions
public void stepOneActions(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, String pSecondCV, int pFactor, int pOffset, String uppermask, String extra1, String extra2, String extra3, String extra4)Description copied from class:SplitVariableValue
Subclasses can override this to pick up constructor-specific attributes and perform other actions before cvList has been built.- Overrides:
stepOneActions
in classSplitVariableValue
- Parameters:
name
- name.comment
- comment.cvName
- cv name.readOnly
- true for read only, else false.infoOnly
- true for info only, else false.writeOnly
- true for write only, else false.opsOnly
- true for ops only, else false.cvNum
- cv number.mask
- cv mask.minVal
- minimum value.maxVal
- maximum value.v
- hashmap of string and cv value.status
- status.stdname
- std name.pSecondCV
- second cv (no longer preferred, specify in cv)pFactor
- factor.pOffset
- offset.uppermask
- upper mask (no longer preferred, specify in mask)extra1
- extra 1.extra2
- extra 2.extra3
- extra 3.extra4
- extra 4.
-
stepTwoActions
Description copied from class:SplitVariableValue
Subclasses can override this to invoke further actions after cvList has been built.- Overrides:
stepTwoActions
in classSplitVariableValue
-
isMatched
-
getBytesFromText
-
getTextFromBytes
-
unsupportedCharset
void unsupportedCharset() -
getCvValsFromTextField
int[] getCvValsFromTextField()- Overrides:
getCvValsFromTextField
in classSplitVariableValue
-
updateVariableValue
Contains byte-value specific code.
Calculates new value for _textField and invokessetValue(newVal)
to make and notify the change- Overrides:
updateVariableValue
in classSplitVariableValue
- Parameters:
intVals
- array of new CV values
-
exitField
void exitField()Contains byte-value specific code.
firePropertyChange for "Value" with new and old contents of _textField- Overrides:
exitField
in classSplitVariableValue
-
actionPerformed
Contains byte-value specific code.
invokesexitField()
to process text and firePropertyChange for "Value" with new contents of _textField- Specified by:
actionPerformed
in interfaceActionListener
- Overrides:
actionPerformed
in classSplitVariableValue
- Parameters:
e
- the action event
-
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.
- Overrides:
getIntValue
in classSplitVariableValue
- Returns:
- the value as an integer
-
getLongValue
Description copied from class:SplitVariableValue
Get the value as an unsigned long.- Overrides:
getLongValue
in classSplitVariableValue
- Returns:
- the value as a long
-
setValue
Description copied from class:SplitVariableValue
Set value from a String value.- Overrides:
setValue
in classSplitVariableValue
- Parameters:
value
- a string representing the Long value to be set
-
setIntValue
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.
- Overrides:
setIntValue
in classSplitVariableValue
- Parameters:
i
- the integer value to set
-
setLongValue
- Overrides:
setLongValue
in classSplitVariableValue
-