fr.cnes.genopus.time
Class GPDateField

java.lang.Object
  extended by fr.cnes.genius.main.GComponent
      extended by fr.cnes.genius.lowLevel.GTextField
          extended by fr.cnes.genopus.time.GPDateField
All Implemented Interfaces:
fr.cnes.genius.main.GDisplay, fr.cnes.genius.main.GListener, ActionListener, FocusListener, KeyListener, EventListener

public class GPDateField
extends fr.cnes.genius.lowLevel.GTextField
implements fr.cnes.genius.main.GListener

Field representing a date. This widget represents a date in different formats-origins and in any given time scales. Allowed formats-origins:

- Cal: <DD>/<MM>/<YYYY> <HH>h<MM>m<SS>s[<AAA>ms][<BBB>us][<CCC>ns] or <DD> <MM> <YYYY> <HH> <MM> <SS>[ <AAA>[ <BBB>[ <CCC>]]]
- jj: ["-"]<Days>[ "."<FractionOfDay>][ "~1950"| "~2000"]
- jj_sec: ["-"]<Days>[ <SecInDay> "." <SecInDayFraction>][ "~1950"| "~2000"]

, with <FractionOfDay> up to 14 digits and <SecInDayFraction> up to 9 digits. <SecInDay> must be lower than 86400.

Author:
aadt

Nested Class Summary
static class GPDateField.GPDateFormat
          Date formats.
 
Nested classes/interfaces inherited from class fr.cnes.genius.lowLevel.GTextField
fr.cnes.genius.lowLevel.GTextField.GDocumentFieldFilterAbstract
 
Nested classes/interfaces inherited from class fr.cnes.genius.main.GComponent
fr.cnes.genius.main.GComponent.CopyPasteOperation, fr.cnes.genius.main.GComponent.DisplayIndicatorStatus, fr.cnes.genius.main.GComponent.ItemType, fr.cnes.genius.main.GComponent.Operation
 
Field Summary
 
Fields inherited from class fr.cnes.genius.main.GComponent
NAME_ATTRIBUTE
 
Constructor Summary
GPDateField(org.orekit.time.AbsoluteDate date, org.orekit.time.TimeScale timeScale)
          Constructor.
GPDateField(String widgetId, org.orekit.time.AbsoluteDate date, org.orekit.time.TimeScale timeScale)
          Constructor.
 
Method Summary
 void after(fr.cnes.genius.main.GEvent e)
          
 void before(fr.cnes.genius.main.GEvent e)
          
static String formatDate(org.orekit.time.AbsoluteDate date, org.orekit.time.TimeScale timeScale, GPDateField.GPDateFormat dateFormat)
          Format an AbsoluteDate in the specified format-origin.
static String formatDateCal(org.orekit.time.AbsoluteDate date, org.orekit.time.TimeScale timeScale)
          Format an AbsoluteDate in calendar format: <DD>/<MM>/<YYYY> <HH>h<MM>m<SS>s[<AAA>ms][<BBB>us][<CCC>ns].
static String formatDateISO8601(org.orekit.time.AbsoluteDate date, org.orekit.time.TimeScale timeScale)
          Format an AbsoluteDate in ISO-8601 format: <YYYY>-<MM>-<DD>T<HH>:<MM>:<SS.SSSSSSSSS>.
static String formatDateJJ(org.orekit.time.AbsoluteDate date, org.orekit.time.AbsoluteDate dateOrigin, org.orekit.time.TimeScale timeScale)
          Format an AbsoluteDate in jj format: ["-" ]<Days>["." <FractionOfDay>][ "~1950"| "~2000"]

, with <FractionOfDay> up to 14 digits.
static String formatDateJJSec(org.orekit.time.AbsoluteDate date, org.orekit.time.AbsoluteDate dateOrigin, org.orekit.time.TimeScale timeScale)
          Format an AbsoluteDate in jj_sec format: ["-" ]<Days>[ <SecInDay> "." <SecInDayFraction>][ "~1950"| "~2000"]

, with <SecInDayFraction> up to 9 digits and <SecInDay> lower than 86400.
 org.orekit.time.AbsoluteDate getDate()
          Date getter.
 GPDateField.GPDateFormat getFormat()
          Date format-origin getter.
 org.orekit.time.TimeScale getScale()
          Time scale getter.
static org.orekit.time.AbsoluteDate parseDateCal(String stringDate, org.orekit.time.TimeScale timeScale)
          Parse a given date string in calendar format as an AbsoluteDate.
static org.orekit.time.AbsoluteDate parseDateISO8601(String stringDate, org.orekit.time.TimeScale timeScale)
          Parse a given date string in ISO-8601 format as an AbsoluteDate.
 org.orekit.time.AbsoluteDate parseDateJJ(String stringDate, org.orekit.time.TimeScale timeScale)
          Parse a given date string in jj format as an AbsoluteDate.
 org.orekit.time.AbsoluteDate parseDateJJSec(String stringDate, org.orekit.time.TimeScale timeScale)
          Parse a given date string in jj_sec format as an AbsoluteDate.
 org.orekit.time.AbsoluteDate parseDateString(String stringDate, org.orekit.time.TimeScale timeScale)
          Parse a given date string as an AbsoluteDate.
 void setDate(org.orekit.time.AbsoluteDate date)
          Date setter.
 void setEnabled(boolean b)
          
 void setFormat(GPDateField.GPDateFormat dateFormat)
          Date format-origin setter.
 void setScale(org.orekit.time.TimeScale timeScale)
          Time scale setter.
 void setValue(String stringDate)
          Set date from string.
 void setWidgetId(String widgetId)
          
 
Methods inherited from class fr.cnes.genius.lowLevel.GTextField
actionPerformed, computeDefaultWidth, display, focusGained, focusLost, getCharWidth, getComponent, getJTextField, getText, keyPressed, keyReleased, keyTyped, setDocumentFilter, setText
 
Methods inherited from class fr.cnes.genius.main.GComponent
activateConstraintsByType, attachCopyPasteMenu, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getSimpleWidgetId, getStatus, getStringConstraint, getSubComponent, getWidgetId, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, isEnabled, isModified, launchInvalidPositionException, parseSimpleConstraint, processGEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDisplayIsModifiedIndicator, setElement, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setNameAndCommentInConfigFile, setNameInConfigFile, setStatus, setStringConstraint, setToolTipText, setWidth, updateIsModifiedIndicator, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPDateField

public GPDateField(org.orekit.time.AbsoluteDate date,
                   org.orekit.time.TimeScale timeScale)
Constructor. The widgetId will be assigned automatically.

Parameters:
date - initial date.
timeScale - time scale in which the date is defined.

GPDateField

public GPDateField(String widgetId,
                   org.orekit.time.AbsoluteDate date,
                   org.orekit.time.TimeScale timeScale)
Constructor.

Parameters:
widgetId - widget identifier.
date - initial date.
timeScale - time scale in which the date is defined.
Method Detail

setWidgetId

public void setWidgetId(String widgetId)

Overrides:
setWidgetId in class fr.cnes.genius.main.GComponent

getDate

public org.orekit.time.AbsoluteDate getDate()
Date getter.

Returns:
the current date in the GDateField

setDate

public void setDate(org.orekit.time.AbsoluteDate date)
Date setter.

Parameters:
date - date to set in the DateField

setValue

public void setValue(String stringDate)
              throws GPDateException
Set date from string.

Parameters:
stringDate - date to set in the DateField
Throws:
GPDateException - if string is in bad format.

getScale

public org.orekit.time.TimeScale getScale()
Time scale getter.

Returns:
the current time scale associated to the date in the GDateField

setScale

public void setScale(org.orekit.time.TimeScale timeScale)
Time scale setter.

Parameters:
timeScale - time scale in which to show the date in the DateField

setFormat

public void setFormat(GPDateField.GPDateFormat dateFormat)
Date format-origin setter.

Parameters:
dateFormat - format (and origin) in which the date will be shown in the DateField

getFormat

public GPDateField.GPDateFormat getFormat()
Date format-origin getter.

Returns:
the format (and origin) in which the date is shown in the DateField

formatDate

public static String formatDate(org.orekit.time.AbsoluteDate date,
                                org.orekit.time.TimeScale timeScale,
                                GPDateField.GPDateFormat dateFormat)
Format an AbsoluteDate in the specified format-origin.
Allowed formats-origins:

- Cal: <DD>/<MM>/<YYYY> <HH>h<MM>m<SS>s[<AAA>ms][<BBB>us][<CCC>ns] or <DD> <MM> <YYYY> <HH> <MM> <SS>[ <AAA>[ <BBB>[ <CCC>]]]
- jj: ["-"]<Days>[ "."<FractionOfDay>][ "~1950"| "~2000"]
- jj_sec: ["-"]<Days>[ <SecInDay> "." <SecInDayFraction>][ "~1950"| "~2000"]

, with <FractionOfDay> up to 14 digits and <SecInDayFraction> up to 9 digits. <SecInDay> must be lower than 86400.

Parameters:
date - date to format
timeScale - date time scale
dateFormat - date format-origin
Returns:
the formatted date in the specified format

formatDateCal

public static String formatDateCal(org.orekit.time.AbsoluteDate date,
                                   org.orekit.time.TimeScale timeScale)
Format an AbsoluteDate in calendar format: <DD>/<MM>/<YYYY> <HH>h<MM>m<SS>s[<AAA>ms][<BBB>us][<CCC>ns].

Parameters:
date - date to format
timeScale - date time scale
Returns:
the formatted date in calendar format

formatDateISO8601

public static String formatDateISO8601(org.orekit.time.AbsoluteDate date,
                                       org.orekit.time.TimeScale timeScale)
Format an AbsoluteDate in ISO-8601 format: <YYYY>-<MM>-<DD>T<HH>:<MM>:<SS.SSSSSSSSS>.

Parameters:
date - date to format
timeScale - date time scale
Returns:
the formatted date in ISO-8601 format

formatDateJJ

public static String formatDateJJ(org.orekit.time.AbsoluteDate date,
                                  org.orekit.time.AbsoluteDate dateOrigin,
                                  org.orekit.time.TimeScale timeScale)
Format an AbsoluteDate in jj format: ["-" ]<Days>["." <FractionOfDay>][ "~1950"| "~2000"]

, with <FractionOfDay> up to 14 digits.

Parameters:
date - date to format
dateOrigin - origin of date
timeScale - date time scale
Returns:
the formatted date in jj format

formatDateJJSec

public static String formatDateJJSec(org.orekit.time.AbsoluteDate date,
                                     org.orekit.time.AbsoluteDate dateOrigin,
                                     org.orekit.time.TimeScale timeScale)
Format an AbsoluteDate in jj_sec format: ["-" ]<Days>[ <SecInDay> "." <SecInDayFraction>][ "~1950"| "~2000"]

, with <SecInDayFraction> up to 9 digits and <SecInDay> lower than 86400.

Parameters:
date - date to format
dateOrigin - origin of date
timeScale - date time scale
Returns:
the formatted date in jj_sec format

parseDateString

public org.orekit.time.AbsoluteDate parseDateString(String stringDate,
                                                    org.orekit.time.TimeScale timeScale)
                                             throws GPDateException
Parse a given date string as an AbsoluteDate. Allowed formats-origins:

- Cal: <DD>/<MM>/<YYYY> <HH>h<MM>m<SS>s[<AAA>ms][<BBB>us][<CCC>ns] or <DD> <MM> <YYYY> <HH> <MM> <SS>[ <AAA>[ <BBB>[ <CCC>]]]
- jj: ["-"]<Days>[ "."<FractionOfDay>][ "~1950"| "~2000"]
- jj_sec: ["-"]<Days>[ <SecInDay> "." <SecInDayFraction>][ "~1950"| "~2000"]

, with <FractionOfDay> up to 14 digits and <SecInDayFraction> up to 9 digits. <SecInDay> must be lower than 86400.

Parameters:
stringDate - date string to parse in calendar, jj or jj_sec (1950 or 2000) format
timeScale - time scale
Returns:
the AbsoluteDate parsed from the date string or null if parsing is not possible (because of bad format or non existing date or reference epoch)
Throws:
GPDateException - if calendar date or reference epoch does not exist

parseDateCal

public static org.orekit.time.AbsoluteDate parseDateCal(String stringDate,
                                                        org.orekit.time.TimeScale timeScale)
                                                 throws GPDateException
Parse a given date string in calendar format as an AbsoluteDate. Allowed formats-origins:

- Cal1: <DD>/<MM>/<YYYY> <HH>h<MM>m<SS>s[<AAA>ms][<BBB>us][<CCC>ns]
- Cal2: <DD> <MM> <YYYY> <HH> <MM> <SS>[ <AAA>[ <BBB>[ <CCC>]]]

Parameters:
stringDate - date string in calendar format to parse
timeScale - time scale
Returns:
the AbsoluteDate parsed from the date string or null if parsing is not possible
Throws:
GPDateException - if calendar date does not exist

parseDateISO8601

public static org.orekit.time.AbsoluteDate parseDateISO8601(String stringDate,
                                                            org.orekit.time.TimeScale timeScale)
                                                     throws GPDateException
Parse a given date string in ISO-8601 format as an AbsoluteDate. Allowed format:
<YYYY>-<MM>-<DD>T<HH>:<MM>:<SS.SSSSSSSSS>.

Parameters:
stringDate - date string in calendar format to parse
timeScale - time scale
Returns:
the AbsoluteDate parsed from the date string or null if parsing is not possible
Throws:
GPDateException - if formatted date does not exist

parseDateJJ

public org.orekit.time.AbsoluteDate parseDateJJ(String stringDate,
                                                org.orekit.time.TimeScale timeScale)
                                         throws GPDateException
Parse a given date string in jj format as an AbsoluteDate. Allowed format-origin:

- jj: ["-"]<Days>[ "."<FractionOfDay>][ "~1950"| "~2000"]

, with <FractionOfDay> up to 14 digits

Parameters:
stringDate - date string in jj format to parse
timeScale - time scale
Returns:
the AbsoluteDate parsed from the date string or null if parsing is not possible
Throws:
GPDateException - if reference epoch does not exist

parseDateJJSec

public org.orekit.time.AbsoluteDate parseDateJJSec(String stringDate,
                                                   org.orekit.time.TimeScale timeScale)
                                            throws GPDateException
Parse a given date string in jj_sec format as an AbsoluteDate. Allowed format-origin:

- jj_sec: ["-"]<Days>[ <SecInDay> "." <SecInDayFraction>][ "~1950"| "~2000"]

, with <SecInDayFraction> up to 9 digits and <SecInDay> lower than 86400.

Parameters:
stringDate - date string in jj_sec format to parse
timeScale - time scale
Returns:
the AbsoluteDate parsed from the date string or null if parsing is not possible
Throws:
GPDateException - if reference epoch does not exist

setEnabled

public void setEnabled(boolean b)

Overrides:
setEnabled in class fr.cnes.genius.lowLevel.GTextField

before

public void before(fr.cnes.genius.main.GEvent e)

Specified by:
before in interface fr.cnes.genius.main.GListener
Overrides:
before in class fr.cnes.genius.lowLevel.GTextField

after

public void after(fr.cnes.genius.main.GEvent e)
           throws GPDateException

Specified by:
after in interface fr.cnes.genius.main.GListener
Overrides:
after in class fr.cnes.genius.lowLevel.GTextField
Throws:
GPDateException


Copyright © 2017. All rights reserved.