org.tentackle.ui
Class BMoneyFormField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by org.tentackle.ui.FormField
                          extended by org.tentackle.ui.NumberFormField
                              extended by org.tentackle.ui.BMoneyFormField
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants, FormComponent, FormFieldComponent

public class BMoneyFormField
extends NumberFormField

FormField to edit a BMoney object.

Author:
harald
See Also:
Serialized Form

Nested Class Summary
 
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
static boolean defaultAutoComma
          application-wide default setting for the auto-comma feature
 
Fields inherited from class org.tentackle.ui.NumberFormField
format
 
Fields inherited from class org.tentackle.ui.FormField
ADJUST_LEFT, ADJUST_NONE, ADJUST_RIGHT, ADJUST_TRIM, CONVERT_LC, CONVERT_NONE, CONVERT_UC, errorOffset
 
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
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BMoneyFormField()
          Creates an empty BMoneyFormField with the default document model, a minimum column width for a BMoney.
BMoneyFormField(boolean parseDMoney)
          Creates an empty BMoneyFormField with the default document model, and minimum column width.
BMoneyFormField(Document doc, int columns, boolean parseDMoney)
          Creates an empty BMoneyFormField.
Notice: setting doc != null requires a doc derived from FormFieldDocument.
BMoneyFormField(int columns, boolean parseDMoney)
          Creates an empty BMoneyFormField with the default document model and given column width.
 
Method Summary
 DMoney getDMoney()
          Gets the value as a DMoney.
 BMoney getFormValue()
          Retrieves the value from this component.
The method is used to update the data if the view has changed because the user edited it.
 boolean isAutoComma()
          Returns the auto-comma setting.
 boolean isParseDMoney()
          Gets the flag whether getFormValue() will return DMoney or BMoney.
 void setAutoComma(boolean autoComma)
          Sets the auto-comma feature.
Allows "business" keyboard input, i.e.
 void setFormat(String pattern)
          Sets the format string.
The format string is used to format the view of the data.
 void setFormValue(Object object)
          Sets a value in this component.
The method is used to update the view if the data has changed.
 void setParseDMoney(boolean parseDMoney)
          Sets whether getFormValue() returns BMoney or DMoney.
 
Methods inherited from class org.tentackle.ui.NumberFormField
doFormat, getFormat, getScale, isBlankZero, isUnsigned, setBlankZero, setScale, setUnsigned, setValidChars
 
Methods inherited from class org.tentackle.ui.FormField
addValueListener, clearText, createDefaultModel, doActionPerformed, downRight, fireValueChanged, fireValueEntered, getAdjust, getConvert, getConverter, getErrorOffset, getFiller, getHelpURL, getInvalidChars, getMaxColumns, getParentWindow, getText, getToolTipText, getValidChars, getVerticalAlignment, invalidateParentInfo, isAutoNext, isAutoSelect, isAutoUpdate, isCaretLeft, isCaretRight, isCellEditorUsage, isChangeable, isEmpty, isEraseFirst, isFireRunning, isFormTraversable, isHonourChangeable, isInhibitAutoSelect, isOverwrite, isStartEditLeftmost, isValueChanged, prepareFocusLost, processFocusEvent, processKeyBinding, removeValueListener, requestFocusLater, saveValue, setAdjust, setAutoNext, setAutoSelect, setAutoUpdate, setCaretLeft, setCaretRight, setCellEditorUsage, setChangeable, setColumns, setConvert, setConverter, setEraseFirst, setFiller, setFireRunning, setFormTraversable, setFormWrapWindow, setHelpURL, setHonourChangeable, setInhibitAutoSelect, setInvalidChars, setMaxColumns, setOverwrite, setStartEditLeftmost, setText, setVerticalAlignment, showHelp, transferFocus, transferFocusBackward, triggerValueChanged, upLeft, wasFocusGainedFromTransfer, wasFocusGainedFromTransferBackward, wasTransferFocus, wasTransferFocusBackward, wasTransferFocusByEnter
 
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, setDocument, 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, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, 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, setEnabled, 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, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.tentackle.ui.FormFieldComponent
getBaseline, getCaretPosition, getColumns, getHorizontalAlignment, setCaretPosition, setHorizontalAlignment, setToolTipText
 
Methods inherited from interface org.tentackle.ui.FormComponent
hasFocus
 

Field Detail

defaultAutoComma

public static boolean defaultAutoComma
application-wide default setting for the auto-comma feature

Constructor Detail

BMoneyFormField

public BMoneyFormField(Document doc,
                       int columns,
                       boolean parseDMoney)
Creates an empty BMoneyFormField.
Notice: setting doc != null requires a doc derived from FormFieldDocument.

Parameters:
doc - the document model, null = default
columns - the number of columns, 0 = minimum width
parseDMoney - true if getFormValue() returns DMoney, false if BMoney

BMoneyFormField

public BMoneyFormField(int columns,
                       boolean parseDMoney)
Creates an empty BMoneyFormField with the default document model and given column width.

Parameters:
columns - the number of columns, 0 = minimum width
parseDMoney - true if getFormValue() returns DMoney, false if BMoney

BMoneyFormField

public BMoneyFormField(boolean parseDMoney)
Creates an empty BMoneyFormField with the default document model, and minimum column width.

Parameters:
parseDMoney - true if getFormValue() returns DMoney, false if BMoney

BMoneyFormField

public BMoneyFormField()
Creates an empty BMoneyFormField with the default document model, a minimum column width for a BMoney.

Method Detail

setFormValue

public void setFormValue(Object object)
Sets a value in this component.
The method is used to update the view if the data has changed.

Overridden to set the scale from the money value

Specified by:
setFormValue in interface FormComponent
Overrides:
setFormValue in class NumberFormField
Parameters:
object - is the object to set

getFormValue

public BMoney getFormValue()
Description copied from interface: FormComponent
Retrieves the value from this component.
The method is used to update the data if the view has changed because the user edited it.

Returns:
the object from the form

getDMoney

public DMoney getDMoney()
Gets the value as a DMoney.

Returns:
the money value or null if field is empty

setParseDMoney

public void setParseDMoney(boolean parseDMoney)
Sets whether getFormValue() returns BMoney or DMoney.

Parameters:
parseDMoney -

isParseDMoney

public boolean isParseDMoney()
Gets the flag whether getFormValue() will return DMoney or BMoney.

Returns:
true if DMoney, else BMoney (default)

setFormat

public void setFormat(String pattern)
Sets the format string.
The format string is used to format the view of the data.

Overridden cause of comma-char.

Specified by:
setFormat in interface FormFieldComponent
Overrides:
setFormat in class NumberFormField
Parameters:
pattern - the format string
See Also:
DecimalFormat

setAutoComma

public void setAutoComma(boolean autoComma)
Sets the auto-comma feature.
Allows "business" keyboard input, i.e. comma is set according to the property scale if no comma has been entered by the user.
 Example: "1122" --> "11.22" if scale was 2.

Parameters:
autoComma - true if automatically set the comma, false if not (default)
See Also:
defaultAutoComma

isAutoComma

public boolean isAutoComma()
Returns the auto-comma setting.

Returns:
true if automatically set the comma according to scale


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de