public class GDateField extends GNumberFieldAbstract implements GListener
GTextField.GDocumentFieldFilterAbstract
GComponent.CopyPasteOperation, GComponent.DisplayIndicatorStatus, GComponent.ItemType, GComponent.Operation
Modifier and Type | Field and Description |
---|---|
static double |
DATE_COMPARISON_PRECISION
Precision for dates comparison (0.5 nanoseconds).
|
static int |
DAY_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of days for getting nanosecond precision.
|
static String |
DECIMAL_SYMBOL
Symbol to be used as decimal separator for dates.
|
static int |
HOUR_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of hours for getting nanosecond precision.
|
static double |
HOURS_2_SECS
Hours to seconds multiplier.
|
static String |
ISO_SYMBOL
Symbol to be used as ISO8601
|
static String |
J00
String
|
static String |
JH00
String
|
static String |
JHM000
String
|
static String |
JHMS0000
String
|
static String |
JHMSMS00000
String
|
static String |
JHMSMSUS000000
String
|
static int |
MICRO_SEC_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of microseconds for getting nanosecond
precision.
|
static double |
MICROSECS_2_SECS
Microseconds to seconds multiplier.
|
static int |
MILI_SEC_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of milliseconds for getting nanosecond
precision.
|
static double |
MILISECS_2_SECS
Milliseconds to seconds multiplier.
|
static int |
MIN_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of minutes for getting nanosecond precision.
|
static double |
MINS_2_SECS
Minutes to seconds multiplier.
|
static String |
MINUS_SYMBOL
Symbol "minus" for dates.
|
static int |
NANO_SEC_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of nanoseconds for getting nanosecond
precision.
|
static double |
NANOSECS_2_SECS
Nanoseconds to seconds multiplier.
|
static int |
SEC_MAX_FRAC_DIGITS
Number of fractional digits to keep on a number of seconds for getting nanosecond precision.
|
static String |
SPACE_SYMBOL
Symbol to be used as space
|
static String |
SUFIX1950
Suffix to indicate that the date's origin is: 01/01/1950 00h00m00s.
|
static String |
SUFIX2000
Suffix to indicate that the date's origin is: 01/01/2000 00h00m00s.
|
static String |
ZZZ
String
|
NAME_ATTRIBUTE
Constructor and Description |
---|
GDateField()
Constructor.
|
GDateField(Date dateValue)
Constructor.
|
GDateField(String textDate)
Constructor.
|
GDateField(String widgetId,
Date dateValue)
Constructor.
|
GDateField(String widgetId,
String textDate)
Constructor.
|
GDateField(String widgetId,
String textValue,
Date dateValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
after(GEvent event)
Called after the event is processed.
|
void |
before(GEvent e)
Called before the event is processed.
|
static String |
format(Date dateValue)
Formats a Date into its string format.
|
String |
formatDuration()
Format duration.
|
static String |
formatDuration(double duration,
GDateUtils.GDateFormat format,
GUnit unit)
Format duration.
|
static String |
formatDurationCal(double duration)
Format duration.
|
static String |
formatDurationFrac(double duration,
GUnit unit)
Format duration.
|
static String |
formatDurationISO8601(double duration)
Format duration.
|
GDateUtils.GDateFormat |
getCurrentDurationFormat()
Getter for the duration format.
|
GEnvironment.Format |
getCurrentFormat()
Get the current format of the field.
|
GUnit |
getCurrentUnit()
Returns the current unit.
|
Date |
getDateValue()
Get the date value of the field.
|
double |
getDuration()
Returns the duration.
|
String |
getDurationString()
Get the duration value of the field as a string.
|
GPopupMenu |
getFormatPopupMenu()
Getter Format PopupMenu
|
String |
getFormattedValue()
Get the current value formatted.
|
String |
getFormattedValue(Object value)
Return the value contained by the field in the format that shall be used to read/write from/to file.
|
int |
getFracDigits()
Get the number of fractinal digits of the field.
|
static double[] |
getTimeComponents(double secondInDayB)
Build a time from the second number within the day.
|
String |
getUnitString()
Get the unit string written directly in the field.
|
Object |
getValue()
Get the current value of the widget.
|
double |
getValueDuration()
Get the duration value of the field as a double.
|
static Date |
parse(String stringValue)
Parse a string into a Date if possible.
|
static double |
parseDuration(String stringDuration,
GUnit unit)
Parse duration.
|
static Double |
parseDurationCal(String stringDuration)
Parse a given duration in Cal1 or Cal2 format as a real number of seconds.
|
static Double |
parseDurationFrac(String stringDuration,
GUnit inputUnit)
Parse duration frac.
|
static Double |
parseDurationISO8601(String stringDuration)
parse text with ISO 8601 format to retrieve duration value
|
void |
setCurrentFormat(GDateUtils.GDateFormat durationFormat)
Setter for the duration format.
|
void |
setCurrentUnit(GUnit durationUnit)
Set current unit.
|
void |
setDateValue(Date dateValue)
Set the date value of the field.
|
void |
setDefaultUnit(GUnit unit)
Set default unit.
|
void |
setDuration(double duration)
Set the duration value of the field with a double.
|
void |
setValue(Object dateValue)
Set the value of the widget.
|
void |
setValue(String stringDuration)
Set the duration value of the field with a string.
|
void |
setWidgetId(String widgetId)
Sets the widget identifier of the component.
|
getIsNotAnInstanceIfNumberError
actionPerformed, computeDefaultWidth, display, focusGained, focusLost, getCharWidth, getComponent, getJTextField, getText, keyPressed, keyReleased, keyTyped, setDocumentFilter, setEnabled, setText
activateConstraintsByType, attachCopyPasteMenu, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, clearAllInnerDescendantConstraint, clearConstraint, clearInnerDescendantContraint, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGClassName, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getPathInConfigFile, getSimpleWidgetId, getStatus, getStringConstraint, getSubComponent, getWidgetId, handleCopyPasteEvent, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, isEnabled, isForcedStatus, isModified, launchInvalidPositionException, mouseWheelMoved, parseSimpleConstraint, processGEvent, processMouseWheelEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDefaultConstraints, setDisplayIsModifiedIndicator, setElement, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setName, setNameAndCommentInConfigFile, setNameInConfigFile, setPathInConfigFile, setStatus, setStringConstraint, setToolTipText, setWidth, setWindowBusyCursor, updateIsModifiedIndicator, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public static final double DATE_COMPARISON_PRECISION
public static final double NANOSECS_2_SECS
public static final double MICROSECS_2_SECS
public static final double MILISECS_2_SECS
public static final double MINS_2_SECS
public static final double HOURS_2_SECS
public static final int NANO_SEC_MAX_FRAC_DIGITS
public static final int MICRO_SEC_MAX_FRAC_DIGITS
public static final int MILI_SEC_MAX_FRAC_DIGITS
public static final int SEC_MAX_FRAC_DIGITS
public static final int MIN_MAX_FRAC_DIGITS
public static final int HOUR_MAX_FRAC_DIGITS
public static final int DAY_MAX_FRAC_DIGITS
public static final String SUFIX2000
public static final String SUFIX1950
public static final String MINUS_SYMBOL
public static final String DECIMAL_SYMBOL
public static final String SPACE_SYMBOL
public static final String ISO_SYMBOL
public static final String ZZZ
public static final String J00
public static final String JH00
public static final String JHM000
public static final String JHMS0000
public static final String JHMSMS00000
public static final String JHMSMSUS000000
public GDateField()
public GDateField(String textDate) throws GDateFieldException, GArithmeticException, ParseException
textDate
- date value as string in the format dd/MM/yyyy HH'h'mm'm'ss's'SSS.GDateFieldException
- in case the date can not be parsed.GArithmeticException
- in case the duration can not be parsed.ParseException
- in case the text can not be parsed.public GDateField(Date dateValue)
dateValue
- date value.public GDateField(String widgetId, String textDate) throws GDateFieldException, GArithmeticException
widgetId
- widget identifier.textDate
- date value as string in the format dd/MM/yyyy HH'h'mm'm'ss's'SSS.GArithmeticException
- in case the duration can not be parsed.GDateFieldException
- in case the date can not be parsed.public GDateField(String widgetId, Date dateValue)
widgetId
- widget identifier.dateValue
- date value.public void setWidgetId(String widgetId)
setWidgetId
in class GComponent
widgetId
- the widget identifier of the component.public void before(GEvent e) throws GException
before
in interface GListener
before
in class GTextField
e
- event to processed.GException
- in case there is a problem managing the event.public void after(GEvent event) throws GException
after
in interface GListener
after
in class GTextField
event
- processed event.GException
- in case there is a problem managing the event.public Date getDateValue()
public Object getValue()
getValue
in class GNumberFieldAbstract
public void setDateValue(Date dateValue)
dateValue
- the date value to set.public void setValue(Object dateValue)
setValue
in class GNumberFieldAbstract
dateValue
- new value of the widget.public void setValue(String stringDuration) throws GDateFieldException, GArithmeticException
stringDuration
- string representing the duration we want to inputGDateFieldException
- in case the date can not be parsed.GArithmeticException
- in case the duration can not be parsed.public GPopupMenu getFormatPopupMenu()
public double getValueDuration()
public void setDuration(double duration) throws GArithmeticException
duration
- double representing the duration we want to inputGArithmeticException
- in case the duration can not be parsed.public String getDurationString() throws GArithmeticException
GArithmeticException
- in case the duration can not be parsed.public static Date parse(String stringValue) throws GDateFieldException
stringValue
- date in string format.GDateFieldException
- in case the date can not be parsed.public static String format(Date dateValue)
dateValue
- the Date object to parse.public String getFormattedValue()
getFormattedValue
in class GNumberFieldAbstract
public String getFormattedValue(Object value)
getFormattedValue
in class GNumberFieldAbstract
value
- to format.public String getUnitString()
getUnitString
in class GNumberFieldAbstract
public GDateUtils.GDateFormat getCurrentDurationFormat()
public GEnvironment.Format getCurrentFormat()
getCurrentFormat
in class GNumberFieldAbstract
public void setCurrentFormat(GDateUtils.GDateFormat durationFormat)
durationFormat
- the format of the durationpublic int getFracDigits()
getFracDigits
in class GNumberFieldAbstract
public static double parseDuration(String stringDuration, GUnit unit) throws GDateFieldException
stringDuration
- duration as stringunit
- unitGDateFieldException
- thrown if failedpublic static Double parseDurationISO8601(String stringDuration)
stringDuration
- text displayedpublic static Double parseDurationCal(String stringDuration) throws GDateFieldException
stringDuration
- duration string in Cal1 or Cal2 format to parseGDateFieldException
- if the string cannot be correctly parsedpublic static Double parseDurationFrac(String stringDuration, GUnit inputUnit)
stringDuration
- durationinputUnit
- unitpublic void setDefaultUnit(GUnit unit)
unit
- unitpublic static String formatDurationFrac(double duration, GUnit unit)
duration
- durationunit
- unitpublic static String formatDurationCal(double duration) throws GArithmeticException
duration
- durationGArithmeticException
- thrown if failedpublic static String formatDurationISO8601(double duration) throws GArithmeticException
duration
- durationGArithmeticException
- thrown if failedpublic static double[] getTimeComponents(double secondInDayB)
secondInDayB
- last part of the second numberpublic static String formatDuration(double duration, GDateUtils.GDateFormat format, GUnit unit) throws GArithmeticException
duration
- durationformat
- formatunit
- output unitGArithmeticException
- thrown if failedpublic String formatDuration()
public void setCurrentUnit(GUnit durationUnit) throws GDateFieldException
durationUnit
- unitGDateFieldException
- thrown if failedpublic double getDuration()
public GUnit getCurrentUnit()
Copyright © 2024. All rights reserved.