public class GPDateOffsetField
extends fr.cnes.genius.lowLevel.GTextField
implements fr.cnes.genius.main.GListener
Modifier and Type | Class and Description |
---|---|
static class |
GPDateOffsetField.GPOffsetFormat
Date formats.
|
Constructor and Description |
---|
GPDateOffsetField(String widgetId,
String textValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
after(fr.cnes.genius.main.GEvent e) |
void |
before(fr.cnes.genius.main.GEvent e) |
String |
formatOffset()
Formats a given offset in seconds into the current format and units defined in the widget.
|
static String |
formatOffset(double offset,
GPDateOffsetField.GPOffsetFormat format,
fr.cnes.genius.unit.GUnit outUnit)
Formats a given offset in seconds into the given format and converting to the given units (unit
conversion is only needed if target format is fractional).
|
static String |
formatOffsetCal(double offset)
Formats a given offset in seconds to the calendar format:
[-]<DD...
|
static String |
formatOffsetFrac(double offset,
fr.cnes.genius.unit.GUnit outUnit)
Formats a given offset in seconds, converting the value to the given units and rounding to a precision
of 1 nanosecond.
|
GPDateOffsetField.GPOffsetFormat |
getCurrentFormat()
Getter for the offset format.
|
fr.cnes.genius.unit.GUnit |
getCurrentUnit()
Get the current unit.
|
double |
getOffset()
Getter for the offset value in seconds.
|
static double |
parseOffset(String stringOffset,
fr.cnes.genius.unit.GUnit inUnit)
Parse a given offset as a real number of seconds.
|
static Double |
parseOffsetCal(String stringOffset)
Parse a given offset in Cal1 or Cal2 format as a real number of seconds.
|
static Double |
parseOffsetFrac(String stringOffset,
fr.cnes.genius.unit.GUnit inUnit)
Parse a given offset in fraction format as a real number of seconds.
|
void |
setCurrentFormat(GPDateOffsetField.GPOffsetFormat offsetFormat)
Setter for the offset format.
|
void |
setCurrentUnit(fr.cnes.genius.unit.GUnit offsetUnit)
Setter for the offset unit.
|
void |
setDefaultUnit(fr.cnes.genius.unit.GUnit unit)
Set the default unit.
|
void |
setOffset(double offset)
Setter for the offset value in seconds.
|
void |
setValue(String stringOffset)
Set offset from string.
|
void |
setWidgetId(String widgetId) |
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, parseSimpleConstraint, processGEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDefaultConstraints, setDisplayIsModifiedIndicator, setElement, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setNameAndCommentInConfigFile, setNameInConfigFile, setStatus, setStringConstraint, setToolTipText, setWidth, updateIsModifiedIndicator, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public void setWidgetId(String widgetId)
setWidgetId
in class fr.cnes.genius.main.GComponent
public void setCurrentUnit(fr.cnes.genius.unit.GUnit offsetUnit) throws GPDateException
offsetUnit
- format in which the offset will be shown in the widget.GPDateException
- if given unit is not available in the widget.public fr.cnes.genius.unit.GUnit getCurrentUnit()
public void setDefaultUnit(fr.cnes.genius.unit.GUnit unit)
unit
- default unit.public void setCurrentFormat(GPDateOffsetField.GPOffsetFormat offsetFormat)
offsetFormat
- format in which the offset will be shown in the widget.public GPDateOffsetField.GPOffsetFormat getCurrentFormat()
public void setOffset(double offset) throws GPDateException, fr.cnes.genius.exception.GArithmeticException
offset
- the offset in seconds to set.GPDateException
- if the absolute value of the offset in days is too high ( Long.MAX_VALUE
)fr.cnes.genius.exception.GArithmeticException
- if offset is NaN.public double getOffset()
public void setValue(String stringOffset) throws GPDateException
stringOffset
- string offset to set.GPDateException
- if offset is in bad format
public static String formatOffset(double offset, GPDateOffsetField.GPOffsetFormat format, fr.cnes.genius.unit.GUnit outUnit) throws GPDateException, fr.cnes.genius.exception.GArithmeticException
offset
- offset in seconds to format.format
- target format.outUnit
- target unit (only if target format is fractional).GPDateException
- if the absolute value of the offset in days is too high ( Long.MAX_VALUE
)fr.cnes.genius.exception.GArithmeticException
- if offset is NaN.public static String formatOffsetCal(double offset) throws GPDateException, fr.cnes.genius.exception.GArithmeticException
offset
- offset in seconds to format.GPDateException
- if the absolute value of the offset in days is too high ( Long.MAX_VALUE
)fr.cnes.genius.exception.GArithmeticException
- if offset is NaNpublic static String formatOffsetFrac(double offset, fr.cnes.genius.unit.GUnit outUnit)
offset
- offset in seconds to format.outUnit
- output unit for the formated offset.public String formatOffset()
public static double parseOffset(String stringOffset, fr.cnes.genius.unit.GUnit inUnit) throws GPDateException
stringOffset
- offset string to parseinUnit
- the time unit in which the string offset is defined (only needed for fractional format if
string offset does not contain the unit)GPDateException
- if offset is in bad formatpublic static Double parseOffsetCal(String stringOffset)
stringOffset
- offset string in Cal1 or Cal2 format to parsepublic static Double parseOffsetFrac(String stringOffset, fr.cnes.genius.unit.GUnit inUnit)
stringOffset
- offset string in fraction format (days, hours, minutes...) to parseinUnit
- the time unit in which the string offset is defined (only needed if string offset does not
contain the unit)public void before(fr.cnes.genius.main.GEvent e) throws fr.cnes.genius.exception.GException
before
in interface fr.cnes.genius.main.GListener
before
in class fr.cnes.genius.lowLevel.GTextField
fr.cnes.genius.exception.GException
public void after(fr.cnes.genius.main.GEvent e) throws GPDateException
after
in interface fr.cnes.genius.main.GListener
after
in class fr.cnes.genius.lowLevel.GTextField
GPDateException
Copyright © 2018. All rights reserved.