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.UndoActionNested classes/interfaces inherited from class javax.swing.JTextField
JTextField.AccessibleJTextFieldNested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBindingNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected intprotected ParamDoubleprotected booleanreal value that this field is set withprotected doubleprotected doubleFields inherited from class rma.swing.RmaJTextField
_minMaxTable, _minMaxTableCol, _modifiable, _name, _parentWindow, _statusLine, _statusText, _trimTrailingWhiteSpaceTxt, _trimTxtFields inherited from class javax.swing.JTextField
notifyActionFields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEYFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields 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 TypeMethodDescriptionvoidconvertAndDisplayParamValue(ParamDouble pd, int fromUs, int toUS) protected Documentreturn the default model as a DecimalNumberDocumentvoidInvoked 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 systemdoublereturn the maximum value that can be entered into this field.doublereturn the minimum value that can be entered into this field.voidreturn the text of this field as a double.doublegetValue()return the value of this field.doublereturn the value of this field.doublegetValueUndefined(double undefinedValue) return the value of this field.booleanbooleanvoidvoidsetDisplayScaleFactor(int paramId, double scaleFactor) Sets a scaling factor to use when displaying the data.voidsetDisplayUnitsSystem(int ut) Sets the current Unit System for this objectvoidvoidsetIgnoreParameterRoundOnRetrive(boolean b) voidsetMaxValue(double max) set the maximum value that can be entered into this fieldvoidsetMinValue(double min) set the minimum value that can entered into this fieldvoidsetModified(boolean b) voidsetPrecision(int precision) set the precision of this fieldvoidsetPrecisionSet(boolean sps) voidvoidsetUseDecimalFormatForParameters(boolean b) voidsetValue(double value) set the value of this field.voidsetValue(int value) set the value of this field.voidsetValue(ParamDouble value) voidbooleanprotected booleanvalidateData(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, takeFocusMethods 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, setScrollOffsetMethods 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, writeMethods 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, updateMethods 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, validateTreeMethods 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:
createDefaultModelin 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:
validateDatain classRmaJTextField
-
focusGained
Description copied from class:RmaJTextFieldInvoked when a this component gains the keyboard focus.- Specified by:
focusGainedin interfaceFocusListener- Overrides:
focusGainedin classRmaJTextField
-
getTableMinMax
public void getTableMinMax() -
setModified
public void setModified(boolean b) - Specified by:
setModifiedin interfaceModifiable- Overrides:
setModifiedin classRmaJTextField
-
getToolTipText
- Overrides:
getToolTipTextin classRmaJTextField
-
getDisplayUnitsString
Description copied from interface:UnitsComponentThis method allows the retrieves the units string for a given units system- Specified by:
getDisplayUnitsStringin interfaceUnitsComponent- See Also:
-
setDisplayScaleFactor
public void setDisplayScaleFactor(int paramId, double scaleFactor) Description copied from interface:UnitsComponentSets a scaling factor to use when displaying the data.- Specified by:
setDisplayScaleFactorin 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:UnitsComponentSets the current Unit System for this object- Specified by:
setDisplayUnitsSystemin interfaceUnitsComponent
-
convertAndDisplayParamValue
-
setUseDecimalFormatForParameters
public void setUseDecimalFormatForParameters(boolean b) -
useDecimalFormatForParameters
public boolean useDecimalFormatForParameters() -
setText
- Overrides:
setTextin classJTextComponent
-
isModified
public boolean isModified()- Specified by:
isModifiedin interfaceModifiable- Overrides:
isModifiedin classRmaJTextField
-