fr.cnes.genopus.time
Class GPDateOffset

java.lang.Object
  extended by fr.cnes.genius.main.GComponent
      extended by fr.cnes.genius.lowLevel.GContainer
          extended by fr.cnes.genopus.time.GPDateOffset
All Implemented Interfaces:
fr.cnes.genius.main.GClear, fr.cnes.genius.main.GDisplay, fr.cnes.genius.main.GListener, fr.cnes.genius.main.GReadWrite

public class GPDateOffset
extends fr.cnes.genius.lowLevel.GContainer
implements fr.cnes.genius.main.GReadWrite, fr.cnes.genius.main.GListener, fr.cnes.genius.main.GDisplay, fr.cnes.genius.main.GClear

Widget defining a date offset. The allowed formats for the offset are:

- Cal1: [-]<DD...>j<HH...>h<MM...>m<SS...>s<AAA...>ms<BBB...>us<CCC...>ns
- Cal2: [-]<DD...> <HH...> <MM...> <SS...> <AAA...> <BBB...> <CCC...>
- Fractional: [-]<Offset>[.<OffsetFraction>][ ~<Unit>]

, with <Unit> one of: j, h, mn, s, ms, us, ns (if not present, default unit is j). The number of digits allowed for <OffsetFraction> depends on the selected <Unit> in order to always have a precision of 1 nanosecond: 14 (for days), 13 (for hours), 11 (for minutes), 9 (for seconds), 6 (for milliseconds), 3 (for microseconds) and 0 for nanoseconds.

Author:
aadt
Default Constraint(s):
IndexClassItemConstraint
0GLabelWithIndicatorlabel0, 0 => "newline , gapleft 0 , split 2"
0, 1 => (null)
1GPDateOffsetFieldoffsetField"split 2"
2GPopupListpopupListUnits(null)


Nested Class Summary
 
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
GPDateOffset(String label)
          Constructor.
GPDateOffset(String label, double offset)
          Constructor.
GPDateOffset(String widgetId, String label)
          Constructor.
GPDateOffset(String widgetId, String label, double offset)
          Constructor.
 
Method Summary
 void addInterval(fr.cnes.genius.interval.GInterval interval)
          Adds a validity interval to the offset value.
 void after(fr.cnes.genius.main.GEvent e)
           
 void attachCopyPasteMenu(String label, fr.cnes.genius.main.GComponent.CopyPasteOperation... operationList)
           
 void before(fr.cnes.genius.main.GEvent e)
           
 void clear()
           
 void display()
           
 void generic()
           
 GPDateOffsetField.GPOffsetFormat getCurrentFormat()
          Getter for the offset format.
 fr.cnes.genius.highLevel.GLabelWithIndicator getGlabel()
          Getter for the label of the widget.
 fr.cnes.genius.highLevel.GPopupList getGPopupList()
          Getter for the GPopupList defining the unit of a fractional offset.
 fr.cnes.genius.lowLevel.GTextField getGTextField()
          Getter for the offset field.
 double getOffset()
          Getter for the offset value.
 fr.cnes.genius.main.GComponent getSubComponent(int position)
          
 boolean isEnabled()
           
 boolean isModified()
           
 void read()
           
 void setConstraint(int labelGap)
          Setter for the constraints of the widget.
 void setCurrentFormat(GPDateOffsetField.GPOffsetFormat offsetFormat)
          Setter for the offset format.
 void setDefaultOffset(double defaultOffset)
          Setter for the default offset value in seconds.
 void setEnabled(boolean b)
           
 void setOffset(double offset)
          Setter for the offset value in seconds.
 void setSavedOffset(double savedOffset)
          Setter for the reference offset value in seconds.
 void setUnit(fr.cnes.genius.unit.GUnit offsetUnit)
          Setter for the offset unit.
 void setValue(String stringOffset)
          Set offset from string.
 void setWidgetId(String widgetId)
          
 void updateIsModifiedIndicator()
           
 void write()
           
 
Methods inherited from class fr.cnes.genius.lowLevel.GContainer
put
 
Methods inherited from class fr.cnes.genius.main.GComponent
activateConstraintsByType, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getComponent, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getSimpleWidgetId, getStatus, getStringConstraint, getWidgetId, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, launchInvalidPositionException, parseSimpleConstraint, processGEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDisplayIsModifiedIndicator, setElement, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setNameAndCommentInConfigFile, setNameInConfigFile, setStatus, setStringConstraint, setToolTipText, setWidth, 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

GPDateOffset

public GPDateOffset(String label)
Constructor. Widget Id is assigned automatically.

Parameters:
label - text to display in the label.

GPDateOffset

public GPDateOffset(String label,
                    double offset)
Constructor. The widgetId will be assigned automatically.

Parameters:
label - text to display in the label.
offset - date offset to set. Its absolute value must be lower than Long.MAX_VALUE

GPDateOffset

public GPDateOffset(String widgetId,
                    String label)
Constructor.

Parameters:
widgetId - widget identifier.
label - text to display in the label.

GPDateOffset

public GPDateOffset(String widgetId,
                    String label,
                    double offset)
Constructor.

Parameters:
widgetId - widget identifier.
label - text to display in the label.
offset - date offset to set. Its absolute value must be lower than Long.MAX_VALUE
Method Detail

setWidgetId

public void setWidgetId(String widgetId)

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

getGlabel

public fr.cnes.genius.highLevel.GLabelWithIndicator getGlabel()
Getter for the label of the widget.

Returns:
the label of the widget.

getGTextField

public fr.cnes.genius.lowLevel.GTextField getGTextField()
Getter for the offset field.

Returns:
the offset field.

getGPopupList

public fr.cnes.genius.highLevel.GPopupList getGPopupList()
Getter for the GPopupList defining the unit of a fractional offset.

Returns:
the GPopupList defining the unit of a fractional offset.

setOffset

public void setOffset(double offset)
               throws GPDateException
Setter for the offset value in seconds.

Parameters:
offset - the offset in seconds to set.
Throws:
GPDateException - if the absolute value of the offset in days is too high ( Long.MAX_VALUE )

setUnit

public void setUnit(fr.cnes.genius.unit.GUnit offsetUnit)
             throws GPDateException
Setter for the offset unit.

Parameters:
offsetUnit - format in which the offset will be shown in the widget.
Throws:
GPDateException - if given unit is not available in the widget.

setValue

public void setValue(String stringOffset)
              throws GPDateException
Set offset from string.

Parameters:
stringOffset - string offset to set.
Throws:
GPDateException - if offset is in bad format

getCurrentFormat

public GPDateOffsetField.GPOffsetFormat getCurrentFormat()
Getter for the offset format.

Returns:
format in which the offset is shown in the widget.

setCurrentFormat

public void setCurrentFormat(GPDateOffsetField.GPOffsetFormat offsetFormat)
Setter for the offset format.

Parameters:
offsetFormat - format in which the offset will be shown in the widget.

setConstraint

public void setConstraint(int labelGap)
Setter for the constraints of the widget.

Parameters:
labelGap - left gap from panel border to display the label

getSubComponent

public fr.cnes.genius.main.GComponent getSubComponent(int position)
                                               throws fr.cnes.genius.exception.GComponentException

Overrides:
getSubComponent in class fr.cnes.genius.main.GComponent
Throws:
fr.cnes.genius.exception.GComponentException

addInterval

public void addInterval(fr.cnes.genius.interval.GInterval interval)
                 throws fr.cnes.genius.exception.GIntervalException
Adds a validity interval to the offset value.

Parameters:
interval - real interval to add.
Throws:
fr.cnes.genius.exception.GIntervalException - in case the interval overlaps with an existing one.

attachCopyPasteMenu

public void attachCopyPasteMenu(String label,
                                fr.cnes.genius.main.GComponent.CopyPasteOperation... operationList)
Overrides:
attachCopyPasteMenu in class fr.cnes.genius.main.GComponent

updateIsModifiedIndicator

public void updateIsModifiedIndicator()
Overrides:
updateIsModifiedIndicator in class fr.cnes.genius.main.GComponent

isEnabled

public boolean isEnabled()
Overrides:
isEnabled in class fr.cnes.genius.main.GComponent

setEnabled

public void setEnabled(boolean b)
Overrides:
setEnabled in class fr.cnes.genius.main.GComponent

isModified

public boolean isModified()
Overrides:
isModified in class fr.cnes.genius.main.GComponent

generic

public void generic()
Specified by:
generic in class fr.cnes.genius.lowLevel.GContainer

display

public void display()
             throws fr.cnes.genius.exception.GException
Specified by:
display in interface fr.cnes.genius.main.GDisplay
Throws:
fr.cnes.genius.exception.GException

before

public void before(fr.cnes.genius.main.GEvent e)
Specified by:
before in interface fr.cnes.genius.main.GListener

after

public void after(fr.cnes.genius.main.GEvent e)
           throws GPDateException
Specified by:
after in interface fr.cnes.genius.main.GListener
Throws:
GPDateException

read

public void read()
          throws fr.cnes.genius.exception.GException
Specified by:
read in interface fr.cnes.genius.main.GReadWrite
Throws:
fr.cnes.genius.exception.GException

write

public void write()
           throws fr.cnes.genius.exception.GException
Specified by:
write in interface fr.cnes.genius.main.GReadWrite
Throws:
fr.cnes.genius.exception.GException

clear

public void clear()
Specified by:
clear in interface fr.cnes.genius.main.GClear

getOffset

public double getOffset()
Getter for the offset value.

Returns:
the offset value.

setDefaultOffset

public void setDefaultOffset(double defaultOffset)
                      throws GPDateException
Setter for the default offset value in seconds.

Parameters:
defaultOffset - the default offset in seconds to set.
Throws:
GPDateException - if the absolute value of the defaultOffset in days is too high ( Long.MAX_VALUE )

setSavedOffset

public void setSavedOffset(double savedOffset)
                    throws GPDateException
Setter for the reference offset value in seconds.

Parameters:
savedOffset - the reference offset in seconds to set.
Throws:
GPDateException - if the absolute value of the defaultOffset in days is too high ( Long.MAX_VALUE )


Copyright © 2017. All rights reserved.