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:
java.awt.event.ActionListener,java.awt.event.FocusListener,java.beans.PropertyChangeListener,java.util.EventListener
public class SplitTextVariableValue extends SplitVariableValue
LikeSplitVariableValue, except that the string representation is text.
Most attributes ofSplitVariableValueare inherited.
Specific attributes for this class are:-
A
matchattribute (which must be aregular expression) can be used to impose constraints on entered text. -
A
termByteStrattribute 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
padByteStrattribute 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
charSetattribute can be used to change the character set used to encode or decode the text string. Valid values are any Java-supportedCharsetname. 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
-
Nested classes/interfaces inherited from class jmri.jmrit.symbolicprog.AbstractValue
AbstractValue.ValueState
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intatest(package private) java.lang.StringcharSet(package private) java.lang.StringmatchRegexstatic java.lang.StringNO_PAD_BYTEstatic java.lang.StringNO_TERM_BYTE(package private) java.lang.StringpadByteStr(package private) java.lang.BytepadByteVal(package private) java.lang.StringtermByteStr(package private) java.lang.BytetermByteVal-
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.VariableValue
_cvMap, _status, _tooltipText
-
Fields inherited from class jmri.jmrit.symbolicprog.AbstractValue
prop
-
-
Constructor Summary
Constructors Constructor Description SplitTextVariableValue(java.lang.String name, java.lang.String comment, java.lang.String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, java.lang.String cvNum, java.lang.String mask, int minVal, int maxVal, java.util.HashMap<java.lang.String,CvValue> v, javax.swing.JLabel status, java.lang.String stdname, java.lang.String pSecondCV, int pFactor, int pOffset, java.lang.String uppermask, java.lang.String extra1, java.lang.String extra2, java.lang.String extra3, java.lang.String extra4)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Contains byte-value specific code.(package private) voidexitField()Contains byte-value specific code.(package private) byte[]getBytesFromText(java.lang.String s)(package private) int[]getCvValsFromTextField()intgetIntValue()Get the value as a single integer.longgetLongValue()Get the value as an unsigned long.(package private) java.lang.StringgetTextFromBytes(byte[] v)(package private) booleanisMatched(java.lang.String s)voidsetIntValue(int i)Set the value from a single number.voidsetLongValue(long i)voidsetValue(java.lang.String value)Set value from a String value.voidstepOneActions(java.lang.String name, java.lang.String comment, java.lang.String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, java.lang.String cvNum, java.lang.String mask, int minVal, int maxVal, java.util.HashMap<java.lang.String,CvValue> v, javax.swing.JLabel status, java.lang.String stdname, java.lang.String pSecondCV, int pFactor, int pOffset, java.lang.String uppermask, java.lang.String extra1, java.lang.String extra2, java.lang.String extra3, java.lang.String extra4)Subclasses can override this to pick up constructor-specific attributes and perform other actions before cvList has been built.voidstepTwoActions()Subclasses can override this to invoke further actions after cvList has been built.(package private) voidunsupportedCharset()(package private) voidupdateVariableValue(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, 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, getMaxMask, 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
-
-
-
-
Field Detail
-
NO_TERM_BYTE
public static final java.lang.String NO_TERM_BYTE
- See Also:
- Constant Field Values
-
NO_PAD_BYTE
public static final java.lang.String NO_PAD_BYTE
- See Also:
- Constant Field Values
-
matchRegex
java.lang.String matchRegex
-
termByteStr
java.lang.String termByteStr
-
padByteStr
java.lang.String padByteStr
-
charSet
java.lang.String charSet
-
termByteVal
java.lang.Byte termByteVal
-
padByteVal
java.lang.Byte padByteVal
-
atest
int atest
-
-
Constructor Detail
-
SplitTextVariableValue
public SplitTextVariableValue(java.lang.String name, java.lang.String comment, java.lang.String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, java.lang.String cvNum, java.lang.String mask, int minVal, int maxVal, java.util.HashMap<java.lang.String,CvValue> v, javax.swing.JLabel status, java.lang.String stdname, java.lang.String pSecondCV, int pFactor, int pOffset, java.lang.String uppermask, java.lang.String extra1, java.lang.String extra2, java.lang.String extra3, java.lang.String extra4)
-
-
Method Detail
-
stepOneActions
public void stepOneActions(java.lang.String name, java.lang.String comment, java.lang.String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, java.lang.String cvNum, java.lang.String mask, int minVal, int maxVal, java.util.HashMap<java.lang.String,CvValue> v, javax.swing.JLabel status, java.lang.String stdname, java.lang.String pSecondCV, int pFactor, int pOffset, java.lang.String uppermask, java.lang.String extra1, java.lang.String extra2, java.lang.String extra3, java.lang.String extra4)
Description copied from class:SplitVariableValueSubclasses can override this to pick up constructor-specific attributes and perform other actions before cvList has been built.- Overrides:
stepOneActionsin 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
public void stepTwoActions()
Description copied from class:SplitVariableValueSubclasses can override this to invoke further actions after cvList has been built.- Overrides:
stepTwoActionsin classSplitVariableValue
-
isMatched
boolean isMatched(java.lang.String s)
-
getBytesFromText
byte[] getBytesFromText(java.lang.String s)
-
getTextFromBytes
java.lang.String getTextFromBytes(byte[] v)
-
unsupportedCharset
void unsupportedCharset()
-
getCvValsFromTextField
int[] getCvValsFromTextField()
- Overrides:
getCvValsFromTextFieldin classSplitVariableValue
-
updateVariableValue
void updateVariableValue(int[] intVals)
Contains byte-value specific code.
Calculates new value for _textField and invokessetValue(newVal)to make and notify the change- Overrides:
updateVariableValuein 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:
exitFieldin classSplitVariableValue
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Contains byte-value specific code.
invokesexitField()to process text and firePropertyChange for "Value" with new contents of _textField- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Overrides:
actionPerformedin classSplitVariableValue- Parameters:
e- the action event
-
getIntValue
public int 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.
- Overrides:
getIntValuein classSplitVariableValue- Returns:
- the value as an integer
-
getLongValue
public long getLongValue()
Description copied from class:SplitVariableValueGet the value as an unsigned long.- Overrides:
getLongValuein classSplitVariableValue- Returns:
- the value as a long
-
setValue
public void setValue(java.lang.String value)
Description copied from class:SplitVariableValueSet value from a String value.- Overrides:
setValuein classSplitVariableValue- Parameters:
value- a string representing the Long value to be set
-
setIntValue
public void setIntValue(int i)
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.
- Overrides:
setIntValuein classSplitVariableValue- Parameters:
i- the integer value to set
-
setLongValue
public void setLongValue(long i)
- Overrides:
setLongValuein classSplitVariableValue
-
-