com.nqadmin.swingSet.formatting
Class SSFormattedTextField

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 javax.swing.JFormattedTextField
                          extended by com.nqadmin.swingSet.formatting.SSFormattedTextField
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextProxy, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.sql.RowSetListener, javax.swing.Scrollable, javax.swing.SwingConstants
Direct Known Subclasses:
SSCuitField, SSCurrencyField, SSDateField, SSIntegerField, SSNumericField, SSPercentField, SSSSNField, SSStringField, SSTimeField, SSTimestampField

public class SSFormattedTextField
extends javax.swing.JFormattedTextField
implements javax.sql.RowSetListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.beans.beancontext.BeanContextProxy, java.awt.event.FocusListener

SSFormattedTextField.java

SwingSet - Open Toolkit For Making Swing Controls Database-Aware

 SSFormattedTextField extends the JFormattedTextField.

Version:
$Revision: 1.26 $
Author:
$Author: prasanth $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFormattedTextField
javax.swing.JFormattedTextField.AbstractFormatter, javax.swing.JFormattedTextField.AbstractFormatterFactory
 
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JFormattedTextField
COMMIT, COMMIT_OR_REVERT, PERSIST, REVERT
 
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
SSFormattedTextField()
          Creates a new instance of SSFormattedTextField
SSFormattedTextField(javax.swing.JFormattedTextField.AbstractFormatterFactory factory)
           
 
Method Summary
 void bind(SSRowSet _sSRowSet, java.lang.String _columnName)
          Sets the SSRowSet and column name to which the component is to be bound.
 void cleanField()
           
 void commitEdit()
           
 void cursorMoved(javax.sql.RowSetEvent event)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 java.beans.beancontext.BeanContextChild getBeanContextProxy()
           
 java.lang.String getColumnName()
          Returns the column name to which the component is bound to
 SSDataNavigator getNavigator()
          Deprecated.  
 SSDataNavigator getSSDataNavigator()
          Returns the SSDataNavigator object being used.
 SSFormattedComboBox getSSFormattedComboBox()
           
 SSRowSet getSSRowSet()
          SSRowSet object being used to get/set the bound column value
 boolean isNullable()
          Getter for property nullable.
 void keyPressed(java.awt.event.KeyEvent e)
          Catch severals keys, to implement some forms functionality (To be done).
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent evt)
           
 void mouseReleased(java.awt.event.MouseEvent evt)
           
 void rowChanged(javax.sql.RowSetEvent event)
           
 void rowSetChanged(javax.sql.RowSetEvent event)
           
 void setColumnName(java.lang.String columnName)
          Sets the column name to which the component should be bound to
 void setHelper(javax.swing.JPopupMenu helper)
          Sets the HelperPopup to be used.
 void setNavigator(SSDataNavigator navigator)
          Deprecated.  
 void setNullable(boolean nullable)
          Setter for property nullable.
 void setRowSet(SSRowSet rowset)
          Deprecated.  
 void setSSDataNavigator(SSDataNavigator navigator)
          Sets the SSDataNavigator being used to navigate the SSRowSet This is needed only if you want to include the function keys as short cuts to perform operations on the DataNavigator like saving the current row/ undo changes/ delete current row.
 void setSSFormattedComboBox(SSFormattedComboBox combo)
           
 void setSSRowSet(SSRowSet rowset)
          Sets the SSRowSet object to be used to get/set the value of the bound column
 void setValue(java.lang.Object value)
          Sets the value of the field to the specified value
 void showHelper(java.awt.event.KeyEvent e)
          Displays the HelperPopup screen.
 boolean updateValue(java.lang.Object value)
          Deprecated. 
 boolean validateField(java.lang.Object value)
          Checks if the value is valid of the component
 
Methods inherited from class javax.swing.JFormattedTextField
getActions, getFocusLostBehavior, getFormatter, getFormatterFactory, getUIClassID, getValue, invalidEdit, isEditValid, processFocusEvent, processInputMethodEvent, setDocument, setFocusLostBehavior, setFormatter, setFormatterFactory
 
Methods inherited from class javax.swing.JTextField
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, 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, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, 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, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, 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, transferFocusBackward, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SSFormattedTextField

public SSFormattedTextField()
Creates a new instance of SSFormattedTextField


SSFormattedTextField

public SSFormattedTextField(javax.swing.JFormattedTextField.AbstractFormatterFactory factory)
Parameters:
factory -
Method Detail

setColumnName

public void setColumnName(java.lang.String columnName)
Sets the column name to which the component should be bound to

Parameters:
columnName - - column name to which the component will be bound to

getColumnName

public java.lang.String getColumnName()
Returns the column name to which the component is bound to

Returns:
- returns the column name to which the component is bound to

setSSFormattedComboBox

public void setSSFormattedComboBox(SSFormattedComboBox combo)
Parameters:
combo -

getSSFormattedComboBox

public SSFormattedComboBox getSSFormattedComboBox()
Returns:

setRowSet

public void setRowSet(SSRowSet rowset)
Deprecated. 

Sets the SSRowSet object to be used to get/set the value of the bound column

Parameters:
rowset - - SSRowSet object to be used to get/set the value of the bound column
See Also:
setSSRowSet(SSRowSet)

setSSRowSet

public void setSSRowSet(SSRowSet rowset)
Sets the SSRowSet object to be used to get/set the value of the bound column

Parameters:
rowset - - SSRowSet object to be used to get/set the value of the bound column

getSSRowSet

public SSRowSet getSSRowSet()
SSRowSet object being used to get/set the bound column value

Returns:
- returns the SSRowSet object being used to get/set the bound column value

setNavigator

public void setNavigator(SSDataNavigator navigator)
Deprecated. 

Sets the SSDataNavigator being used to navigate the SSRowSet This is needed only if you want to include the function keys as short cuts to perform operations on the DataNavigator like saving the current row/ undo changes/ delete current row. The functionality for this is not yet finalized so try to avoid using this

Parameters:
navigator - - SSDataNavigator being used to navigate the SSRowSet
See Also:
setSSDataNavigator(SSDataNavigator)

getNavigator

public SSDataNavigator getNavigator()
Deprecated. 

Returns the SSDataNavigator object being used.

Returns:
returns the SSDataNavigator object being used.
See Also:
getSSDataNavigator()

setSSDataNavigator

public void setSSDataNavigator(SSDataNavigator navigator)
Sets the SSDataNavigator being used to navigate the SSRowSet This is needed only if you want to include the function keys as short cuts to perform operations on the DataNavigator like saving the current row/ undo changes/ delete current row. The functionality for this is not yet finalized so try to avoid using this

Parameters:
navigator - - SSDataNavigator being used to navigate the SSRowSet

getSSDataNavigator

public SSDataNavigator getSSDataNavigator()
Returns the SSDataNavigator object being used.

Returns:
returns the SSDataNavigator object being used.

bind

public void bind(SSRowSet _sSRowSet,
                 java.lang.String _columnName)
Sets the SSRowSet and column name to which the component is to be bound.

Parameters:
_sSRowSet - datasource to be used.
_columnName - Name of the column to which this check box should be bound

rowSetChanged

public void rowSetChanged(javax.sql.RowSetEvent event)
Specified by:
rowSetChanged in interface javax.sql.RowSetListener

rowChanged

public void rowChanged(javax.sql.RowSetEvent event)
Specified by:
rowChanged in interface javax.sql.RowSetListener

cursorMoved

public void cursorMoved(javax.sql.RowSetEvent event)
Specified by:
cursorMoved in interface javax.sql.RowSetListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Catch severals keys, to implement some forms functionality (To be done). This is to mimic console legacy systems behavior.

Specified by:
keyPressed in interface java.awt.event.KeyListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

setHelper

public void setHelper(javax.swing.JPopupMenu helper)
Sets the HelperPopup to be used.

Parameters:
helper - - HelperPopup to be used.

showHelper

public void showHelper(java.awt.event.KeyEvent e)
Displays the HelperPopup screen.

Parameters:
e - - the key event which triggered the helper popup

updateValue

@Deprecated
public boolean updateValue(java.lang.Object value)
Deprecated. 

This function has been deprecated, use setValue to set the value in database. This is done to reduce the confusion of when to use setValue and when to use updateValue. Before this change setValue is a function in JFormattedText field and it would not set the value in database, so we have overridden this function in this class to update database and then update the display. Sets the value of the field to the specified value

Parameters:
value - - The value to be set for this component (this will also update the underlying column value)
Returns:
returns true if update is successful else false

setValue

public void setValue(java.lang.Object value)
Sets the value of the field to the specified value

Overrides:
setValue in class javax.swing.JFormattedTextField
Parameters:
value - - The value to be set for this component (this will also update the underlying column value)

getBeanContextProxy

public java.beans.beancontext.BeanContextChild getBeanContextProxy()
Specified by:
getBeanContextProxy in interface java.beans.beancontext.BeanContextProxy

commitEdit

public void commitEdit()
                throws java.text.ParseException
Overrides:
commitEdit in class javax.swing.JFormattedTextField
Throws:
java.text.ParseException

validateField

public boolean validateField(java.lang.Object value)
Checks if the value is valid of the component

Parameters:
value - - value to be validated
Returns:
returns true if the value is valid else false

isNullable

public boolean isNullable()
Getter for property nullable.

Returns:
Value of property nullable.

setNullable

public void setNullable(boolean nullable)
Setter for property nullable.

Parameters:
nullable - New value of property nullable.

cleanField

public void cleanField()