public class GEntryRealVector extends GEntryVectorAbstract
GTable1D
object. This object is composed of a list of
input fields of real numbers and a pull-down menu of type GPopupList
to display units when units
are defined for the vector. This class implements save and load of values in the configuration file
following the definition of the class GEntryVectorAbstract
. The class GEntryRealVector is a
sub-class of GEntryVectorAbstract
which is in charge of:
GComponent.CopyPasteOperation, GComponent.DisplayIndicatorStatus, GComponent.ItemType, GComponent.Operation
NAME_ATTRIBUTE
Constructor and Description |
---|
GEntryRealVector(String name,
ArrayList<Double> valueList)
Constructor.
|
GEntryRealVector(String name,
double[] valueArray)
Constructor.
|
GEntryRealVector(String name,
double[] valueArray,
GUnit[] unitArray)
Constructor.
|
GEntryRealVector(String name,
List<Double> valueList,
GUnit[] unitArray)
Constructor.
|
GEntryRealVector(String widgetId,
String name,
ArrayList<Double> valueList)
Constructor.
|
GEntryRealVector(String widgetId,
String name,
double[] valueArray)
Constructor.
|
GEntryRealVector(String widgetId,
String name,
double[] valueArray,
GUnit[] unitArray)
Constructor.
|
GEntryRealVector(String widgetId,
String name,
List<Double> valueList,
GUnit[] unitArray)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int rank,
Object value)
Adds an item to the vector.
|
double[] |
getDoubleArray()
Returns the array of values stored in the array as doubles.
|
GPopupList |
getGUnitMenu()
Get the unit menu widget.
|
GComponent |
getSubComponent(int position)
Gets the subcomponent occupying the position defined by position.
|
protected GUnit |
getUnitInConfig()
Get the unit in configuration file.
|
Number |
getValue(int rank)
Get the value of the element corresponding to the index "rank".
|
boolean |
handleEvent(GEvent event)
Handles an event provided by the GTable1D.
|
boolean |
isModified()
Gets the modification status of the component against the last set of values loaded or saved.
|
protected Number |
parseValue(String value)
Parse the value in string format and return a Number to be stored in the vector.
|
protected void |
readVector(org.jdom.Element e,
String unitString)
Reads the elements of the vector from file.
|
void |
remove(int rank)
Remove an element from the vector.
|
void |
removeAll()
Remove all the elements from the vector.
|
void |
setDefaultValue(Object defaultValue)
Set the new default value.
|
void |
setEnabled(boolean flag)
Set the enable status of the component.
|
void |
setFormatMode(GEnvironment.Format formatMode)
Sets the format allowed for the field.
|
void |
setFracDigits(int fracDigits)
Set the number of fractional digits.
|
void |
setSavedValue(int rank,
Object numberValue)
Sets the saved value of an element of the vector and then updates the modified indicator.
|
void |
setValue(int rank,
Object numberValue)
Sets the value of an element of the vector and then updates the status of the vector.
|
void |
setWidgetId(String widgetId)
Sets the widget identifier of the component.
|
void |
updateStatus()
Update the status information of the vector.
|
protected void |
writeVector(org.jdom.Element parentElement)
Writes the elements of the vector to the file.
|
addGInterval, addItem, getGComponent, getGLabelWithIndicator, getGNumberField, getIntervalList, getLabelConstraint, getName, getNameInConfigFile, getValueArray, isEnabled, read, removeAllInternal, removeGInterval, setComponentConstraint, setDefaultConstraints, setFieldValue, setLabelAndUnitConstraint, setLabelConstraint, setNameInConfigFile, setToolTipText, size, updateGInterval, updateIntervalMessage, updateIsModifiedIndicator, updateStatus, write
activateConstraintsByType, attachCopyPasteMenu, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, clearAllInnerDescendantConstraint, clearConstraint, clearInnerDescendantContraint, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getComponent, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGClassName, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getOperationSaveValue, getPathInConfigFile, getSimpleWidgetId, getStatus, getStringConstraint, getWidgetId, handleCopyPasteEvent, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, isForcedStatus, launchInvalidPositionException, mouseWheelMoved, parseSimpleConstraint, processGEvent, processMouseWheelEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDisplayIsModifiedIndicator, setElement, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setName, setNameAndCommentInConfigFile, setPathInConfigFile, setStatus, setStringConstraint, setWidth, setWindowBusyCursor, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public GEntryRealVector(String name, double[] valueArray)
name
- of the vector.valueArray
- list of initial values.public GEntryRealVector(String widgetId, String name, double[] valueArray)
widgetId
- widget identifier.name
- of the vector.valueArray
- list of initial values.public GEntryRealVector(String name, ArrayList<Double> valueList)
name
- of the vector.valueList
- list of initial values.public GEntryRealVector(String widgetId, String name, ArrayList<Double> valueList)
widgetId
- widget identifier.name
- of the vector.valueList
- list of initial values.public GEntryRealVector(String name, double[] valueArray, GUnit[] unitArray)
name
- of the vector.valueArray
- list of initial values.unitArray
- array containing the GUnits applicable to the field.public GEntryRealVector(String widgetId, String name, double[] valueArray, GUnit[] unitArray)
widgetId
- widget identifier.name
- of the vector.valueArray
- list of initial values.unitArray
- array containing the GUnits applicable to the field.public GEntryRealVector(String name, List<Double> valueList, GUnit[] unitArray)
name
- of the vector.valueList
- list of initial values.unitArray
- array containing the GUnits applicable to the field.public GEntryRealVector(String widgetId, String name, List<Double> valueList, GUnit[] unitArray)
widgetId
- widget identifier.name
- of the vector.valueList
- list of initial values.unitArray
- array containing the GUnits applicable to the field.public double[] getDoubleArray()
public void add(int rank, Object value) throws GArithmeticException
add
in class GEntryVectorAbstract
rank
- of the new item.value
- of the new item.GArithmeticException
- if memoryValue is NaNpublic void remove(int rank)
GEntryVectorAbstract
remove
in class GEntryVectorAbstract
rank
- of the element to remove.public void removeAll()
GEntryVectorAbstract
removeAll
in class GEntryVectorAbstract
public GPopupList getGUnitMenu()
GEntryVectorAbstract
getGUnitMenu
in class GEntryVectorAbstract
protected GUnit getUnitInConfig()
GEntryVectorAbstract
getUnitInConfig
in class GEntryVectorAbstract
public Number getValue(int rank)
GEntryVectorAbstract
getValue
in class GEntryVectorAbstract
rank
- index of the element for which the value is returned.public void setValue(int rank, Object numberValue) throws GArithmeticException
setValue
in class GEntryVectorAbstract
rank
- of the value to update.numberValue
- the value in SI units, it will be displayed in the field after the
appropriate unit transformation.GArithmeticException
- if numberValue is NaNpublic void setSavedValue(int rank, Object numberValue) throws GArithmeticException, GException
setSavedValue
in class GEntryVectorAbstract
rank
- of the value to update its saved status.numberValue
- the value in SI units.GArithmeticException
- if numberValue is NaN.GException
- if numberValue is NaN or if rank is out of bounds.public void setEnabled(boolean flag)
GComponent
setEnabled
in class GEntryVectorAbstract
flag
- new enable status of the component.protected void writeVector(org.jdom.Element parentElement)
GEntryVectorAbstract
writeVector
in class GEntryVectorAbstract
parentElement
- where the values are stored.GEntryVectorAbstract.readVector(Element, String).
protected void readVector(org.jdom.Element e, String unitString) throws GException
GEntryVectorAbstract
readVector
in class GEntryVectorAbstract
e
- from where the values are read.unitString
- unit read from the configuration file, that shall be used to set the current
unit at vector level.GException
- in case of problem reading the vector from file.GEntryVectorAbstract.writeVector(Element).
protected Number parseValue(String value)
GEntryVectorAbstract
parseValue
in class GEntryVectorAbstract
value
- string containing the value to be parsed.public void setWidgetId(String widgetId)
setWidgetId
in class GEntryVectorAbstract
widgetId
- the widget identifier of the component.public void setFracDigits(int fracDigits) throws GEntryRealException
fracDigits
- number of fractional digits.GEntryRealException
- in case the number of fractionary digits is bigger than the MAX_FRAC_DIGITS (defaults to
15).public void setFormatMode(GEnvironment.Format formatMode)
formatMode
- allowed for the field.public boolean handleEvent(GEvent event)
handleEvent
in class GEntryVectorAbstract
event
- to treat.public boolean isModified()
GComponent
isModified
in class GComponent
public void updateStatus()
GEntryVectorAbstract
updateStatus
in class GEntryVectorAbstract
public void setDefaultValue(Object defaultValue) throws GArithmeticException
setDefaultValue
in class GEntryVectorAbstract
defaultValue
- new default value.GArithmeticException
- if defaultValue is NaNpublic GComponent getSubComponent(int position) throws GComponentException
getSubComponent
in class GEntryVectorAbstract
position
- position of the requested component.GComponentException
- in case the position argument is invalid.Copyright © 2024. All rights reserved.