Ontimize 5.2072EN

com.ontimize.gui.field
Class CurrencyDataField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.ontimize.gui.field.DataField
                      extended bycom.ontimize.gui.field.TextFieldDataField
                          extended bycom.ontimize.gui.field.CurrencyDataField
All Implemented Interfaces:
AccessForm, javax.accessibility.Accessible, AdvancedDataComponent, ApplicationPreferencesListener, DataComponent, java.util.EventListener, FormComponent, HasHelpIdComponent, HasPreferenceComponent, IdentifiedElement, java.awt.image.ImageObserver, Internationalization, java.awt.MenuContainer, OpenDialog, SecureElement, SelectCurrencyValues, java.io.Serializable, ValueChangeDataComponent
Direct Known Subclasses:
CalculatedCurrencyDataField

public class CurrencyDataField
extends TextFieldDataField
implements OpenDialog, SelectCurrencyValues, AdvancedDataComponent

This class implements a field to introduce coins.
The base coin is EURO, so the setValue() and getValue() methods makes operation in that unit.
It is supported the change operation mode between Euro and Pesetas (1 Euro = 166.386 pta)

Author:
Imatia Innovation
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.ontimize.gui.field.TextFieldDataField
TextFieldDataField.EJTextField, TextFieldDataField.InnerDocumentListener
 
Nested classes inherited from class com.ontimize.gui.field.DataField
DataField.AuxPanel, DataField.CopyActionListener, DataField.ELabel, DataField.FieldButton, DataField.FieldFocusListener, DataField.InfoMouseListener, DataField.ToggleButton
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JMenuItem advancedHelpBMenu
          A reference for advanced help menu.
protected  Calculator calc
          A calculator reference.
protected  javax.swing.JButton calcButton
          A reference for a calc button.
protected  javax.swing.JButton currencyButton
          An instance of currency button.
static boolean DEFAULT_EURO_BUTTON_VISIBLE
          The default visibility condition for euro button.
protected  java.lang.String euro
          An instance of Euro.
protected  javax.swing.ImageIcon euroIcon
          The euro icon.
protected  java.awt.Frame frame
          A reference for the frame.
protected  java.lang.String pst
          An instance of Pta.
protected  javax.swing.ImageIcon pstIcon
          The pta icon.
protected  boolean showEuros
          The condition to show euro coin.
 
Fields inherited from class com.ontimize.gui.field.TextFieldDataField
disabledTextColor, innerListener
 
Fields inherited from class com.ontimize.gui.field.DataField
advancedQueryMode, ALIGN, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, alignment, ASTERISK_REQUIRED_STYLE, ATTR, attribute, backgroundColor, BGCOLOR, bold, BOLD, BORDER, BORDER_REQUIRED_STYLE, borderText, BOTTOM, CENTER, CLIPBOARD_COPY, CLIPBOARD_COPY_es_ES, CLIPBOARD_CUT, CLIPBOARD_CUT_es_ES, CLIPBOARD_PASTE, CLIPBOARD_PASTE_es_ES, conditions, dataField, DEFAULT_BORDER, DEFAULT_BOTTOM_MARGIN, DEFAULT_FIELD_LEFT_MARGIN, DEFAULT_FIELD_RIGHT_MARGIN, DEFAULT_LABEL_LEFT_MARGIN, DEFAULT_LABEL_RIGHT_MARGIN, DEFAULT_PARENT_MARGIN, DEFAULT_PARENT_MARGIN_FOR_SCROLL, DEFAULT_TOP_MARGIN, defaultAsteriskColor, DEFAULTBORDER, defaultDisableBackgroundColor, defaultFieldButtonHigh, defaultPreferenceTextNotRetrievedFromPreferences, DEFINE_HELP_FIELD_PREFERENCE, dim, DIM, disabledbgcolor, DISABLEDBGCOLOR, empty, enabled, ENABLED, FIELD_HELP_TIP, fieldlistenerFocus, fieldSize, fireValueEvents, FOCUS_BACKGROUNDCOLOR, FONT, fontColor, FONTCOLOR, fontSize, FONTSIZE, height, HEIGHT, incrementalFont, initPreferenceHelpText, isEnabled, LABELALIGN, labelComponent, LABELFONT, LABELFONTCOLOR, labelPosition, LABELPOSITION, LABELSIZE, labelText, LABELVISIBLE, LEFT, locale, LOWERED, menuCopy, menuCut, menuDefineHelpPreference, menuHelpPreferences, menuPaste, modifiable, NO_STR, NONE, noRequiredBorder, OPAQUE, originalSize, OUTBORDER, panel, parentForm, permissionActivate, permissionVisible, popupMenu, RAISED, redimensionPanel, redimensJTextField, required, REQUIRED, requiredBorder, REQUIREDBORDER, requiredFieldBackgroundColor, resources, restricted, RIGHT, show, showLabel, SIZE, TEXT_STR, TEXTALIGN, textAlignment, textHelpPreference, TIP, tipKey, TOP, validData, VALIGN, Valignment, valueListener, valueSave, VISIBLE, VISUALIZE_HELP_FIELD_PREFERENCE, weightDataFieldH, weightPanelH, width, WIDTH, x, X, y, Y, YES_STR
 
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 com.ontimize.gui.SelectCurrencyValues
EURO, PST
 
Fields inherited from interface com.ontimize.gui.field.AdvancedDataComponent
ADVANCED_QUERY
 
Fields inherited from interface com.ontimize.gui.field.DataComponent
COMP_FOCUS_YELLOW, GREEN_VERY_LIGHT, LIGHT_GRAY_BLUE, LIGHT_GREYISH_BLUE, VERY_LIGHT_BLUE, VERY_LIGHT_GRAY, VERY_LIGHT_PINK, VERY_LIGHT_RED, VERY_LIGHT_SKYBLUE, VERY_LIGHT_YELLOW, VERY_LIGHT_YELLOW_2
 
Fields inherited from interface com.ontimize.gui.field.FormComponent
DEBUG
 
Fields inherited from interface com.ontimize.gui.i18n.Internationalization
DEBUG_LANGUAGE
 
Fields inherited from interface com.ontimize.gui.SecureElement
DESACTIVATE_COMPONENT_BY_PERMISSION_TIP
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
 
Constructor Summary
CurrencyDataField(java.util.Hashtable parameters)
          The class constructor.
 
Method Summary
protected  boolean colorSelection(javax.swing.event.DocumentEvent e)
          Checks the consistency of currency document value, changing the color to red with an incorrect value.
protected  void createDataField()
          Creates the data field.
protected  void createPopupMenu()
          Creates a pop-up menu.
 java.lang.Object getDoubleValue()
          Gets the double value.
 int getSQLDataType()
          Returns the sql data type according to java.sql.Types
 java.lang.Object getValue()
          Gets the value of a component.
 void init(java.util.Hashtable parameters)
          Initializes parameters.
protected  void installInnerListener()
          Installs an inner listener.
protected  void installValidationDocumentListener()
          Installs a listener for validate document.
 boolean isEmpty()
          Checks the data existence in component.
 boolean isModified()
          This method should be return true when data have been modified.
 void setAdvancedQueryMode(boolean enable)
          This method must establish the advanced query state, to support advanced query conditions.
 void setComponentLocale(java.util.Locale loc)
           
 void setEnabled(boolean enabled)
          Description method to set enabled or not the component according the boolean condition in parameter.
 void setFontSize(int size)
          Sets font size to size parameter.
 void setParentFrame(java.awt.Frame parentFrame)
          This method is called from Form for each component that implements this interface.
 void setResourceBundle(java.util.ResourceBundle resource)
          Sets the language resource bundle.
protected  void setTip()
          Sets the tip for field.
 void setValue(java.lang.Object value)
          Sets the value for component.
 void showCurrencyValue(int currencyId)
           
protected  void showPopupMenu(java.awt.Component c, int x, int y)
          Shows the pop-up menu.
 void updateUI()
           
 
Methods inherited from class com.ontimize.gui.field.TextFieldDataField
deleteData, getAttribute, getInnerListenerEnabled, getInnerValue, getLabelComponentText, getText, isInnerValueEqual, isModifiable, isRequired, setInnerListenerEnabled, setInnerValue
 
Methods inherited from class com.ontimize.gui.field.DataField
addFocusListener, addHelpMenuPopup, addValueChangeListener, changeButton, changeOpacity, checkDefineHelpPermission, checkEnabledPermission, checkVisiblePermission, configurePopupMenuHelp, createFocusListener, createInstanceConditionCombo, defineHelpField, finalize, fireValueChanged, getBorder, getConstraints, getDataField, getDisabledbgcolor, getFontColor, getHelpIdString, getHelpPreferenceKey, getLabelComponent, getLabelFontColor, getLabelText, getParentForm, getPreferenceHelpText, getTextsToTranslate, getValueChangeListeners, hasHelpInPreferences, initPermissions, initPreferences, installFocusListener, installHelpId, installPopupMenuListener, installPreferenceHelpListener, isAdvancedQueryMode, isEnabled, isHidden, isLabelVisible, isRestricted, parseBoolean, preferenceChanged, removeFocusListener, removeValueChangeListener, requestFocus, seeHelpField, setBold, setDisabledbgcolor, setFont, setFontColor, setLabelFontColor, setModifiable, setParentForm, setRequired, setRequiredFieldBackground, setVisible, updateBackgroundColor, updateBackgroundColor, updateFont, updateTip, validateComponentPositions
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ontimize.gui.field.DataComponent
deleteData, getLabelComponentText, isHidden, isModifiable, isRequired, setModifiable, setRequired
 
Methods inherited from interface com.ontimize.gui.field.FormComponent
getConstraints, isEnabled, setVisible
 
Methods inherited from interface com.ontimize.gui.i18n.Internationalization
getTextsToTranslate
 
Methods inherited from interface com.ontimize.gui.field.IdentifiedElement
getAttribute
 
Methods inherited from interface com.ontimize.gui.SecureElement
initPermissions, isRestricted
 

Field Detail

DEFAULT_EURO_BUTTON_VISIBLE

public static boolean DEFAULT_EURO_BUTTON_VISIBLE
The default visibility condition for euro button. By default, false.


euroIcon

protected javax.swing.ImageIcon euroIcon
The euro icon. By default, null.


pstIcon

protected javax.swing.ImageIcon pstIcon
The pta icon. By default, null.


euro

protected java.lang.String euro
An instance of Euro.


pst

protected java.lang.String pst
An instance of Pta.


currencyButton

protected javax.swing.JButton currencyButton
An instance of currency button. By default, null.


showEuros

protected boolean showEuros
The condition to show euro coin. By default, true.


advancedHelpBMenu

protected javax.swing.JMenuItem advancedHelpBMenu
A reference for advanced help menu. By default, null.


frame

protected java.awt.Frame frame
A reference for the frame. By default, null.


calcButton

protected javax.swing.JButton calcButton
A reference for a calc button. By default, null.


calc

protected Calculator calc
A calculator reference. By default, null.

Constructor Detail

CurrencyDataField

public CurrencyDataField(java.util.Hashtable parameters)
The class constructor. Inits parameters and installs a validation document listener.

Parameters:
parameters - the Hashtable with parameters.
Method Detail

init

public void init(java.util.Hashtable parameters)
Initializes parameters.

Specified by:
init in interface FormComponent
Overrides:
init in class TextFieldDataField
Parameters:
parameters - the Hashtable with parameters.

attribute values default required meaning
change yes/no yes To support the change in the currency value.
calc yes/no no no The presence of the calendar.
minintegerdigits no The minimum number of integer digits.
maxintegerdigits no The maximum number of integer digits.
mindecimaldigits no The minimum number of decimal digits.
maxdecimaldigits no The maximum number of decimal digits.
grouping yes/no no The condition to put the numbers in groups (1 000 000 -> 1000000)

createDataField

protected void createDataField()
Description copied from class: TextFieldDataField
Creates the data field.

Overrides:
createDataField in class TextFieldDataField

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: FormComponent
Description method to set enabled or not the component according the boolean condition in parameter.

Specified by:
setEnabled in interface FormComponent
Overrides:
setEnabled in class DataField
Parameters:
enabled - the condition to set enable

getValue

public java.lang.Object getValue()
Description copied from interface: DataComponent
Gets the value of a component.

Specified by:
getValue in interface DataComponent
Returns:
the object with value.

setValue

public void setValue(java.lang.Object value)
Description copied from interface: DataComponent
Sets the value for component.

Specified by:
setValue in interface DataComponent
Parameters:
value - the object with value to set

getSQLDataType

public int getSQLDataType()
Description copied from interface: DataComponent
Returns the sql data type according to java.sql.Types

Specified by:
getSQLDataType in interface DataComponent
Returns:
the Integer type

getDoubleValue

public java.lang.Object getDoubleValue()
Gets the double value.

Returns:
the double value

setTip

protected void setTip()
Sets the tip for field.


showCurrencyValue

public void showCurrencyValue(int currencyId)
Specified by:
showCurrencyValue in interface SelectCurrencyValues

isModified

public boolean isModified()
Description copied from interface: DataComponent
This method should be return true when data have been modified. The method setValue() should be change this condition.

Specified by:
isModified in interface DataComponent
Overrides:
isModified in class DataField

setFontSize

public void setFontSize(int size)
Description copied from class: DataField
Sets font size to size parameter.

Overrides:
setFontSize in class DataField
Parameters:
size - the font size parameter

updateUI

public void updateUI()
Overrides:
updateUI in class DataField

setAdvancedQueryMode

public void setAdvancedQueryMode(boolean enable)
Description copied from interface: AdvancedDataComponent
This method must establish the advanced query state, to support advanced query conditions.

Specified by:
setAdvancedQueryMode in interface AdvancedDataComponent
Parameters:
enable - the condition to enable this state

colorSelection

protected boolean colorSelection(javax.swing.event.DocumentEvent e)
Checks the consistency of currency document value, changing the color to red with an incorrect value.

Parameters:
e - the document event
Returns:
the consistency condition

createPopupMenu

protected void createPopupMenu()
Description copied from class: DataField
Creates a pop-up menu.

Overrides:
createPopupMenu in class DataField

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle resource)
Description copied from interface: Internationalization
Sets the language resource bundle. When the application changes the configured language, for all the objects that implement this interface this method must be called with the new file.
The method must translate all the elements that have texts in the GUI

Specified by:
setResourceBundle in interface Internationalization
Overrides:
setResourceBundle in class DataField

showPopupMenu

protected void showPopupMenu(java.awt.Component c,
                             int x,
                             int y)
Description copied from class: DataField
Shows the pop-up menu.

Overrides:
showPopupMenu in class DataField
Parameters:
c - the component
x - the x coordinate
y - the y coordinate

isEmpty

public boolean isEmpty()
Description copied from interface: DataComponent
Checks the data existence in component.

Specified by:
isEmpty in interface DataComponent
Overrides:
isEmpty in class TextFieldDataField

installValidationDocumentListener

protected void installValidationDocumentListener()
Installs a listener for validate document.


setParentFrame

public void setParentFrame(java.awt.Frame parentFrame)
Description copied from interface: OpenDialog
This method is called from Form for each component that implements this interface. It fixes the parent frame for element. This frame is needed to open the modal dialog.

Specified by:
setParentFrame in interface OpenDialog
Parameters:
parentFrame - the frame

installInnerListener

protected void installInnerListener()
Description copied from class: TextFieldDataField
Installs an inner listener.

Overrides:
installInnerListener in class TextFieldDataField

setComponentLocale

public void setComponentLocale(java.util.Locale loc)
Specified by:
setComponentLocale in interface Internationalization
Overrides:
setComponentLocale in class DataField

Ontimize