Package jmri.jmrit.symbolicprog
Class SplitDateTimeVariableValue
- java.lang.Object
-
- jmri.jmrit.symbolicprog.AbstractValue
-
- jmri.jmrit.symbolicprog.VariableValue
-
- jmri.jmrit.symbolicprog.SplitVariableValue
-
- jmri.jmrit.symbolicprog.SplitDateTimeVariableValue
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.FocusListener,java.beans.PropertyChangeListener,java.util.EventListener
public class SplitDateTimeVariableValue extends SplitVariableValue
LikeSplitVariableValue, except that the string representation is a date and time relative to a given epoch start date.-
A
baseattribute is required to indicate the epoch (zero) date and must be in XML dateTime format"YYYY-MM-DDThh:mm:ss"(all components are required). For example, the RailCom (S9.3.2) epoch is "2000-01-01T00:00:00", while the Java epoch is "1970-01-01T00:00:00" -
A
unitattribute specifies the time unit of the value stored in the CVs. The default is"Seconds"and the available units are"Nanos","Micros","Millis","Seconds","Minutes","Hours","HalfDays","Days","Weeks","Months","Years","Decades","Centuries","Millennia"as perChronoUnit.values() -
A
factorattribute can be used to specify that the stored value is in multiples of aunit. For example, if the stored value is in tenths of a second, useunit="Millis", factor="100". Large values offactorshould be avoided, due to the possibility of multiplication overflow. -
A
displayattribute specifies the what is returned in the string representation The default is to return both date and time and the available displays are"dateOnly","timeOnly"and"default".
readOnly, even though the underlying CV values may not bereadOnly.
-
-
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) java.time.LocalDateTimebase(package private) java.lang.Stringdisplay(package private) longfactor(package private) longstoredValueSince we are not parsing text to value, we need to save the current value to return withgetValueFromText.(package private) java.lang.Stringunit-
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 SplitDateTimeVariableValue(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 (package private) java.lang.StringgetTextFromDateTime(java.time.LocalDateTime dateTime)(package private) java.lang.StringgetTextFromValue(long v)(package private) longgetValueFromText(java.lang.String s)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.-
Methods inherited from class jmri.jmrit.symbolicprog.SplitVariableValue
actionPerformed, dispose, enterField, exitField, focusGained, focusLost, getCommonRep, getCvDescription, getCvNum, getCvValsFromTextField, getIntValue, getLongValue, getMask, getMask, getNewRep, getValueObject, getValueString, isChanged, isToRead, isToWrite, priorityValue, propertyChange, rangeVal, readAll, readChanges, setAvailable, setColor, setCvState, setIntValue, setLongValue, setToolTipText, updatedTextField, updateVariableValue, 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
-
base
java.time.LocalDateTime base
-
factor
long factor
-
unit
java.lang.String unit
-
display
java.lang.String display
-
storedValue
long storedValue
Since we are not parsing text to value, we need to save the current value to return withgetValueFromText.
-
-
Constructor Detail
-
SplitDateTimeVariableValue
public SplitDateTimeVariableValue(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
-
getValueFromText
long getValueFromText(java.lang.String s)
- Overrides:
getValueFromTextin classSplitVariableValue
-
getTextFromValue
java.lang.String getTextFromValue(long v)
- Overrides:
getTextFromValuein classSplitVariableValue
-
getTextFromDateTime
java.lang.String getTextFromDateTime(java.time.LocalDateTime dateTime)
- Parameters:
dateTime- aLocalDateTimevalue.- Returns:
- a string representation of
dateTime.
-
setValue
public void setValue(java.lang.String value)
Set value from a String value.This does nothing since we can't reliably parse text to date/time value.
- Overrides:
setValuein classSplitVariableValue- Parameters:
value- a string representing the date/time value to be set
-
-