Package rma.swing

Class RmaJDecimalField

All Implemented Interfaces:
FocusListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, DocumentListener, Scrollable, SwingConstants, Modifiable, ModifiedEventControl, UnitsComponent, EditableComponent, FormManagementListener, RmaValidComponent

public class RmaJDecimalField extends RmaJTextField implements UnitsComponent
extension of the JTextField to only allow decimal type numbers
See Also:
  • Field Details

    • _precisionSet

      protected boolean _precisionSet
      real value that this field is set with
    • _value

      protected double _value
    • _paramValue

      protected ParamDouble _paramValue
    • _scaleFactor

      protected double _scaleFactor
    • _paramScaleId

      protected int _paramScaleId
    • _displayUnitsSystem

      protected int _displayUnitsSystem
    • _needsConversion

      protected boolean _needsConversion
  • Constructor Details

    • RmaJDecimalField

      public RmaJDecimalField()
    • RmaJDecimalField

      public RmaJDecimalField(int value)
    • RmaJDecimalField

      public RmaJDecimalField(int value, int columns)
  • Method Details

    • getDecimalFormatter

      public DecimalFormat getDecimalFormatter()
      Retuns a new DecimalFormat object that does not group and is in the US Locale
    • setDecimalFormat

      public void setDecimalFormat(DecimalFormat df)
    • ignoreParameterRoundOnRetrieve

      public boolean ignoreParameterRoundOnRetrieve()
    • setIgnoreParameterRoundOnRetrive

      public void setIgnoreParameterRoundOnRetrive(boolean b)
    • getParamValue

      public ParamDouble getParamValue()
    • getValue

      public double getValue()
      return the value of this field. If not defined return 0. if the field has had it's value set with setValue() and hasn't modified by the user return the original setValue() value, not the displayed contents of the field.
    • getHecDouble

      public HecDouble getHecDouble()
    • getValueUndefined

      public double getValueUndefined(double undefinedValue)
      return the value of this field. If not defined return undefinedValue. if the field has had it's value set with setValue() and hasn't modified by the user return the original setValue() value, not the displayed contents of the field.
    • getValueUndefined

      public double getValueUndefined()
      return the value of this field. If not defined return UNDEF_DOUBLE. if the field has had it's value set with setValue() and hasn't modified by the user return the original setValue() value, not the displayed contents of the field.
    • setPrecisionSet

      public void setPrecisionSet(boolean sps)
    • setPrecision

      public void setPrecision(int precision)
      set the precision of this field
    • getTextAsDbl

      public Double getTextAsDbl()
      return the text of this field as a double. the initial value set with setValue() is ignored.
    • setValue

      public void setValue(int value)
      set the value of this field. What's displayed may be different based on the settings of the DecimalFormat.
    • setValue

      public void setValue(ParamDouble value)
    • setDisplayUnitsSystemOnLabeledBy

      public void setDisplayUnitsSystemOnLabeledBy()
    • setValue

      public void setValue(HecDouble value)
    • setValue

      public void setValue(double value)
      set the value of this field. What's displayed may be different based on the settings of the DecimalFormat. if the value is RMAConst.UNDEF_DOUBLE the field will be cleared of it's displayed text.
    • createDefaultModel

      protected Document createDefaultModel()
      return the default model as a DecimalNumberDocument
      Overrides:
      createDefaultModel in class RmaJTextField
      Returns:
      the default model implementation
      See Also:
    • setMinValue

      public void setMinValue(double min)
      set the minimum value that can entered into this field
    • getMinValue

      public double getMinValue()
      return the minimum value that can be entered into this field. if not set return RMAConst.UNDEF_DOUBLE
    • setMaxValue

      public void setMaxValue(double max)
      set the maximum value that can be entered into this field
    • getMaxValue

      public double getMaxValue()
      return the maximum value that can be entered into this field. if not set return RMAConst.UNDEF_DOUBLE
    • validateData

      protected boolean validateData(boolean showErrorMsg)
      check that the data in this field is valid
      Overrides:
      validateData in class RmaJTextField
    • focusGained

      public void focusGained(FocusEvent e)
      Description copied from class: RmaJTextField
      Invoked when a this component gains the keyboard focus.
      Specified by:
      focusGained in interface FocusListener
      Overrides:
      focusGained in class RmaJTextField
    • getTableMinMax

      public void getTableMinMax()
    • setModified

      public void setModified(boolean b)
      Specified by:
      setModified in interface Modifiable
      Overrides:
      setModified in class RmaJTextField
    • getToolTipText

      public String getToolTipText()
      Overrides:
      getToolTipText in class RmaJTextField
    • getDisplayUnitsString

      public String getDisplayUnitsString(int unitSystem)
      Description copied from interface: UnitsComponent
      This method allows the retrieves the units string for a given units system
      Specified by:
      getDisplayUnitsString in interface UnitsComponent
      See Also:
    • setDisplayScaleFactor

      public void setDisplayScaleFactor(int paramId, double scaleFactor)
      Description copied from interface: UnitsComponent
      Sets a scaling factor to use when displaying the data.
      Specified by:
      setDisplayScaleFactor in interface UnitsComponent
      Parameters:
      paramId - This is the identifier of the paramater to scale. If the data is not of this type then it is ignored
      scaleFactor - This is the scaling factor *to* be multiplied to the value when it is rendered
    • setDisplayUnitsSystem

      public void setDisplayUnitsSystem(int ut)
      Description copied from interface: UnitsComponent
      Sets the current Unit System for this object
      Specified by:
      setDisplayUnitsSystem in interface UnitsComponent
    • convertAndDisplayParamValue

      public void convertAndDisplayParamValue(ParamDouble pd, int fromUs, int toUS)
    • setUseDecimalFormatForParameters

      public void setUseDecimalFormatForParameters(boolean b)
    • useDecimalFormatForParameters

      public boolean useDecimalFormatForParameters()
    • setText

      public void setText(String text)
      Overrides:
      setText in class JTextComponent
    • isModified

      public boolean isModified()
      Specified by:
      isModified in interface Modifiable
      Overrides:
      isModified in class RmaJTextField