Package rma.swing
Class RmaJDecimalField
- All Implemented Interfaces:
FocusListener
,MouseMotionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,DocumentListener
,Scrollable
,SwingConstants
,Modifiable
,ModifiedEventControl
,UnitsComponent
,EditableComponent
,FormManagementListener
,RmaValidComponent
extension of the JTextField to only allow decimal type numbers
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class rma.swing.RmaJTextField
RmaJTextField.RedoAction, RmaJTextField.UndoAction
Nested classes/interfaces inherited from class javax.swing.JTextField
JTextField.AccessibleJTextField
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected boolean
protected int
protected ParamDouble
protected boolean
real value that this field is set withprotected double
protected double
Fields inherited from class rma.swing.RmaJTextField
_minMaxTable, _minMaxTableCol, _modifiable, _name, _parentWindow, _statusLine, _statusText, _trimTrailingWhiteSpaceTxt, _trimTxt
Fields inherited from class javax.swing.JTextField
notifyAction
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
convertAndDisplayParamValue
(ParamDouble pd, int fromUs, int toUS) protected Document
return the default model as a DecimalNumberDocumentvoid
Invoked when a this component gains the keyboard focus.Retuns a new DecimalFormat object that does not group and is in the US LocalegetDisplayUnitsString
(int unitSystem) This method allows the retrieves the units string for a given units systemdouble
return the maximum value that can be entered into this field.double
return the minimum value that can be entered into this field.void
return the text of this field as a double.double
getValue()
return the value of this field.double
return the value of this field.double
getValueUndefined
(double undefinedValue) return the value of this field.boolean
boolean
void
void
setDisplayScaleFactor
(int paramId, double scaleFactor) Sets a scaling factor to use when displaying the data.void
setDisplayUnitsSystem
(int ut) Sets the current Unit System for this objectvoid
void
setIgnoreParameterRoundOnRetrive
(boolean b) void
setMaxValue
(double max) set the maximum value that can be entered into this fieldvoid
setMinValue
(double min) set the minimum value that can entered into this fieldvoid
setModified
(boolean b) void
setPrecision
(int precision) set the precision of this fieldvoid
setPrecisionSet
(boolean sps) void
void
setUseDecimalFormatForParameters
(boolean b) void
setValue
(double value) set the value of this field.void
setValue
(int value) set the value of this field.void
setValue
(ParamDouble value) void
boolean
protected boolean
validateData
(boolean showErrorMsg) check that the data in this field is validMethods inherited from class rma.swing.RmaJTextField
addPopupAction, changedUpdate, clearPerformed, displayMsg, displayMsgInQueue, errorMsg, fixToolTip, focusLost, forwardModifiedEvents, getForwardModifiedEvents, getIgnoreModifiedEvents, getMaxLength, getName, getText, getToolTipText, insertUpdate, isCursorKey, isEmptyOk, isIgnoringModifiedEvents, isValid, mouseDragged, mouseMoved, popupMenuAction, removeAWTEnterKeyCompatibility, removeUpdate, replaceSelection, setChangeColor, setDisplayMsgInQueue, setDocument, setEditable, setEmptyOk, setEnabled, setFowardModifiedEvents, setIgnoreModifiedEvents, setIsEditable, setLowercaseOnly, setMaxLength, setMinMaxTable, setModifiable, setName, setShowErrorMsg, setStatusLineField, setTrimTrailingWhiteSpace, setTrimWhiteSpace, setUppercaseOnly, showToolTipWindow, takeFocus
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setFont, setHorizontalAlignment, setScrollOffset
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, loadKeymap, modelToView, modelToView2D, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, viewToModel2D, write
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
_precisionSet
protected boolean _precisionSetreal value that this field is set with -
_value
protected double _value -
_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
Retuns a new DecimalFormat object that does not group and is in the US Locale -
setDecimalFormat
-
ignoreParameterRoundOnRetrieve
public boolean ignoreParameterRoundOnRetrieve() -
setIgnoreParameterRoundOnRetrive
public void setIgnoreParameterRoundOnRetrive(boolean b) -
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
-
getValueUndefined
public double getValueUndefined(double undefinedValue) return the value of this field. If not defined returnundefinedValue
. 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
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
-
setDisplayUnitsSystemOnLabeledBy
public void setDisplayUnitsSystemOnLabeledBy() -
setValue
-
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
return the default model as a DecimalNumberDocument- Overrides:
createDefaultModel
in classRmaJTextField
- 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 classRmaJTextField
-
focusGained
Description copied from class:RmaJTextField
Invoked when a this component gains the keyboard focus.- Specified by:
focusGained
in interfaceFocusListener
- Overrides:
focusGained
in classRmaJTextField
-
getTableMinMax
public void getTableMinMax() -
setModified
public void setModified(boolean b) - Specified by:
setModified
in interfaceModifiable
- Overrides:
setModified
in classRmaJTextField
-
getToolTipText
- Overrides:
getToolTipText
in classRmaJTextField
-
getDisplayUnitsString
Description copied from interface:UnitsComponent
This method allows the retrieves the units string for a given units system- Specified by:
getDisplayUnitsString
in interfaceUnitsComponent
- 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 interfaceUnitsComponent
- Parameters:
paramId
- This is the identifier of the paramater to scale. If the data is not of this type then it is ignoredscaleFactor
- 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 interfaceUnitsComponent
-
convertAndDisplayParamValue
-
setUseDecimalFormatForParameters
public void setUseDecimalFormatForParameters(boolean b) -
useDecimalFormatForParameters
public boolean useDecimalFormatForParameters() -
setText
- Overrides:
setText
in classJTextComponent
-
isModified
public boolean isModified()- Specified by:
isModified
in interfaceModifiable
- Overrides:
isModified
in classRmaJTextField
-