public class DatetimeFormat extends DisplayFormat
datetime
and datetime-tz
variables.Modifier and Type | Class and Description |
---|---|
private class |
DatetimeFormat.DatetimeBuf
Internal form of datetime data.
|
private static class |
DatetimeFormat.DatetimeComponent
The simple structure which records what places are occupied in a screen
value by the datetime component.
|
DisplayFormat.Presentation
Modifier and Type | Field and Description |
---|---|
protected boolean |
allQMark
If a value cannot be correctly represented with current format a string of question marks
will be used instead.
|
protected boolean |
amPmUppercase |
protected byte[] |
dateCompOrder
Order of date components for rendering.
|
protected byte[] |
datetimeCompOrder
Order of datetime(-tz) components for rendering.
|
protected boolean |
drawSeparators
Determines whether the separators will be drawn for the unknown value
(applies to editing mode only).
|
protected DatetimeFormat.DatetimeComponent[] |
fmtDatetimeComps
How date components are positioned in rendered string.
|
protected boolean |
fmtFullYear
true for a 4-digit year. |
protected char |
fmtSeparator
Date components separator.
|
private boolean |
isDatetimeTz
If set, SESSION:DISPLAY-TIMEZONE will be taken into consideration when displaying
values if the format misses the timezone component.
|
editableSource, fmtScreenWidth
Modifier | Constructor and Description |
---|---|
private |
DatetimeFormat(java.lang.String format,
byte[] dateCompOrder,
byte[] datetimeCompOrder,
char fmtSeparator,
boolean amPmUppercase,
boolean drawSeparators,
boolean fmtFullYear,
boolean allQMark,
boolean isDatetimeTz,
int fmtScreenWidth,
DatetimeFormat.DatetimeComponent[] fmtDatetimeComps)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
DisplayFormat.Presentation |
clear(DisplayFormat.Presentation pres)
Returns a new presentation instance with a default initialized insert mode and
cursor position.
|
DisplayFormat.Presentation |
fromVar(BaseDataType var)
Initializes a presentation for variable's value.
|
boolean |
isFormatCheck()
Verify if this format needs explicit validation.
|
static DatetimeFormat |
parse(java.lang.String pformat,
boolean isDatetimeTz)
Constructs a datetime format from the given Progress format string.
|
private static int |
parseComponent(byte comp,
char c,
int fromIdx,
java.lang.String fmt,
int len,
DatetimeFormat.DatetimeComponent[] fmtDatetimeComps)
Parse one format component.
|
void |
setDrawSeparators(boolean drawSeparators)
Forces separators for the unknown datetime value to be drawn or not in the
subsequent value rendering (applies to editing mode only).
|
clear, formatScreenValue, generateQuestions, generateSpaces, genValueCannotBeDisplayedError, getFormatDef, getScreenWidth, instanceOfType, instanceOfType, instanceOfType, isCharInterface, isRightPositioning, isZapSupported, setCharInterface, setEditableSource
protected final byte[] dateCompOrder
protected final byte[] datetimeCompOrder
protected final char fmtSeparator
protected final boolean amPmUppercase
protected boolean drawSeparators
protected final boolean fmtFullYear
true
for a 4-digit year.protected final DatetimeFormat.DatetimeComponent[] fmtDatetimeComps
protected boolean allQMark
private final boolean isDatetimeTz
private DatetimeFormat(java.lang.String format, byte[] dateCompOrder, byte[] datetimeCompOrder, char fmtSeparator, boolean amPmUppercase, boolean drawSeparators, boolean fmtFullYear, boolean allQMark, boolean isDatetimeTz, int fmtScreenWidth, DatetimeFormat.DatetimeComponent[] fmtDatetimeComps)
parse(String, boolean)
to create instances of this class.format
- the format stringdateCompOrder
- the indices of date components, an array of 3 bytes with values from 0 to 2datetimeCompOrder
- the indices of all datetime components, an array of 10 bytesfmtSeparator
- the character used to separate date componentsamPmUppercase
- true is the AL/PM component is defined and is in upper case charactersdrawSeparators
- draw separators flagfmtFullYear
- format includes a 4-digits year specificationallQMark
- allQMark flag (???)isDatetimeTz
- formatting as datetime-tz (???)fmtScreenWidth
- the number of characters in formatted stringfmtDatetimeComps
- all datetime componentsprivate static final int parseComponent(byte comp, char c, int fromIdx, java.lang.String fmt, int len, DatetimeFormat.DatetimeComponent[] fmtDatetimeComps)
comp
- the component id, e.g. HOURS, MINUTESc
- the placeholder character, like 'H'fromIdx
- the start index in the format stringfmt
- the format stringlen
- the format string lengthfmtDatetimeComps
- public static DatetimeFormat parse(java.lang.String pformat, boolean isDatetimeTz) throws ErrorConditionException
pformat
- Progress format string.isDatetimeTz
- This format will be used with a datetimetz instance.ErrorConditionException
- When passed format is not a valid datetime format.public boolean isFormatCheck()
isFormatCheck
in class DisplayFormat
true
.public DisplayFormat.Presentation clear(DisplayFormat.Presentation pres)
clear
in class DisplayFormat
pres
- A Presentation instance which was constructed by this format. May be
null
. This presentation instance is not changed in this method.public DisplayFormat.Presentation fromVar(BaseDataType var) throws DisplayFormatCheckException
fromVar
in class DisplayFormat
var
- Variable which should be compatible with format.DisplayFormatCheckException
- Variable's value is incompatible with format.public void setDrawSeparators(boolean drawSeparators)
drawSeparators
- If true
then separators will be displayed for the
unknown datetime value.