public class GEntryReal extends GEntryNumberAbstract implements GReadWrite, GListener, GClear
GRealField
,
and of a pop-up menu GPopupList
for display and selection of unit when unit is defined for the
field. The class implements save / load of values in the configuration. The class inherits of class
GEntryNumberAbstract
which is in charge of validity range handling.Index | Class | Item | Constraint |
0 | GLabelWithIndicator | label | 0, 0 => "newline , split 2" 0, 1 => (null) |
1 | GRealField | textField | (null) |
2 | GPopupList | units | (null) |
GComponent.CopyPasteOperation, GComponent.DisplayIndicatorStatus, GComponent.ItemType, GComponent.Operation
NAME_ATTRIBUTE
Constructor and Description |
---|
GEntryReal()
Constructor by default.
|
GEntryReal(String label,
double value)
Constructor.
|
GEntryReal(String label,
double value,
GUnit[] units)
Constructor.
|
GEntryReal(String widgetId,
String label,
double memoryValue)
Constructor.
|
GEntryReal(String widgetId,
String label,
double memoryValue,
GUnit[] units)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
after(GEvent e)
Called after the event is processed.
|
void |
before(GEvent e)
Called before the event is processed.
|
void |
clear()
Called when the element is to be cleared, so it can perform the actions required to return to the last
saved/loaded values.
|
void |
generic()
The prototype of the generic function that shall exist in all the descendants.
|
GUnit |
getCurrentUnit()
Return the currently selected unit.
|
double |
getDefaultValue()
Get the default value of the entry as a double.
|
GPopupList |
getGUnitsPopupList()
Gettern for the units popupList.
|
protected Number |
getNumber()
Get the value of the entry as a Number so it can be used for real and integer values.
|
double |
getSavedValue()
Get the saved value.
|
GComponent |
getSubComponent(int position)
Gets the subcomponent occupying the position defined by position.
|
GUnit[] |
getUnitsArray()
Method to get the the units as an array or null if it has not units.
|
double |
getValue()
Get the value of the entry as a double.
|
boolean |
isModified()
Gets the modification status of the component against the last set of values loaded or saved.
|
void |
read()
Implementaion of the routines that allow the component to be loaded from a configuration file.
|
void |
setCurrentFormat(GEnvironment.Format formatMode)
Sets the current format.
|
void |
setDefaultValue(double memoryValue)
Set the default value.
|
void |
setEnabled(boolean b)
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(double memoryValue)
Set the saved value.
|
void |
setUnit(String unit)
Sets the unit of the entry, the value displayed in the entry is converted to the new unit.
|
void |
setValue(double memoryValue)
Set the value of the entry.
|
void |
setWidgetId(String widgetId)
Sets the widget identifier of the component.
|
protected void |
updateIsModifiedIndicator()
Updates the is modified indicator.
|
void |
updateStatus()
Update the status of the field applying the defined validity intervals.
|
void |
write()
Implementaion of the routines that allow the component to be saved to a configuration file.
|
addGInterval, attachCopyPasteMenu, display, getGField, getGInterval, getGLabelWithIndicator, getGTextField, isCopyPasteEvent, isEnabled, removeGInterval, setDefaultConstraints, setShortcut, setStringConstraint, setToolTipText, updateGInterval, updateIntervalMessage
put
activateConstraintsByType, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, clearAllInnerDescendantConstraint, clearConstraint, clearInnerDescendantContraint, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getComponent, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGClassName, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getPathInConfigFile, getSimpleWidgetId, getStatus, getStringConstraint, getWidgetId, handleCopyPasteEvent, handleCopyPasteEvent, handleProcessEventException, isForcedStatus, launchInvalidPositionException, mouseWheelMoved, parseSimpleConstraint, processGEvent, processMouseWheelEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDisplayIsModifiedIndicator, setElement, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setName, setNameAndCommentInConfigFile, setNameInConfigFile, setPathInConfigFile, setStatus, setWidth, setWindowBusyCursor, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public GEntryReal()
public GEntryReal(String label, double value)
label
- for the entry.value
- initial value.public GEntryReal(String label, double value, GUnit[] units)
label
- for the entry.value
- initial value.units
- list of units to display in the unit menu.GEntryRealException
public GEntryReal(String widgetId, String label, double memoryValue)
widgetId
- widged identifier.label
- for the entry.memoryValue
- initial value.public GPopupList getGUnitsPopupList()
public GComponent getSubComponent(int position) throws GComponentException
getSubComponent
in class GEntryNumberAbstract
position
- position of the requested component.GComponentException
- in case the position argument is invalid.public void setWidgetId(String widgetId)
setWidgetId
in class GEntryNumberAbstract
widgetId
- the widget identifier of the component.public void setFormatMode(GEnvironment.Format formatMode)
formatMode
- allowed for the field.public void setCurrentFormat(GEnvironment.Format formatMode)
formatMode
- the current format.public void setFracDigits(int fracDigits) throws GEntryRealException
fracDigits
- number of fractional digits.GEntryRealException
- in case the number of fractionary digits is bigger than MAX_FRAC_DIGITS (defaults to 15).protected Number getNumber()
getNumber
in class GEntryNumberAbstract
public void generic() throws GException
generic
in class GEntryNumberAbstract
GException
- In case of problem.public void setEnabled(boolean b)
setEnabled
in class GEntryNumberAbstract
b
- new enable status of the component.public GUnit[] getUnitsArray()
public double getValue()
public double getDefaultValue()
public void setValue(double memoryValue) throws GArithmeticException
memoryValue
- to set for the entry.GArithmeticException
- if memoryValue is NaN, positive infinity or negative infinity.public void setDefaultValue(double memoryValue) throws GArithmeticException
memoryValue
- new default value.GArithmeticException
- if memoryValue is NaN, positive infinity or negative infinity.public void setSavedValue(double memoryValue) throws GArithmeticException
memoryValue
- new saved value.GArithmeticException
- if memoryValue is NaN, positive infinity or negative infinity.public double getSavedValue()
public void setUnit(String unit)
unit
- name.public GUnit getCurrentUnit()
public void before(GEvent e)
public void after(GEvent e) throws GException, GFileManipulatorException
after
in interface GListener
e
- processed event.GException
- in case there is a problem managing the event.GFileManipulatorException
public void read() throws GException
read
in interface GReadWrite
GException
- in case of problem while reading the value from file.public void write() throws GException
write
in interface GReadWrite
GException
- in case of problem while writing the value to file.public boolean isModified()
isModified
in class GComponent
public void clear() throws GException
clear
in interface GClear
GException
- in case of problem while clearing the values.protected void updateIsModifiedIndicator()
updateIsModifiedIndicator
in class GComponent
public void updateStatus()
updateStatus
in class GEntryNumberAbstract
Copyright © 2024. All rights reserved.