Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.ui
Class JFormattedTextFieldCellEditor

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 com.ibm.etools.iseries.ui.JFormattedTextField
                          extended by com.ibm.etools.iseries.ui.JFormattedTextFieldCellEditor
All Implemented Interfaces:
EditmaskAttributesChangeListener, JFormattedComponent, ActionListener, FocusListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditor, Scrollable, SwingConstants, TableCellEditor

public class JFormattedTextFieldCellEditor
extends JFormattedTextField
implements TableCellEditor, ActionListener, Serializable

This class is a wrapper class of com.ibm.etools.iseries.ui.JFormattedTextField that implements the TableCellEditor interface. It can be used as a table cell editor for a JFormattedTableColumn in JFormattedTable, particularly for AS/400 data.

See Also:
JFormattedTextField, TableCellEditor, 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
protected  ChangeEvent changeEvent
           
static String Copyright
           
protected  boolean focusGained
           
protected  boolean focusLost
           
protected  Border noFocusBorder
           
 
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, 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.ibm.etools.iseries.ui.JFormattedComponent
copyright
 
Fields inherited from interface com.ibm.etools.iseries.ui.EditmaskAttributesChangeListener
copyright
 
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
JFormattedTextFieldCellEditor()
          Creates a new JFormattedTextFieldCellEditor.
JFormattedTextFieldCellEditor(Document doc, String text, int columns)
          Creates a new JFormattedTextFieldCellEditor with the specified document, text and column number.
JFormattedTextFieldCellEditor(Document doc, String text, int columns, FieldModel fm)
          Creates a new JFormattedTextFieldCellEditor with the specified document, text, column number and field model.
JFormattedTextFieldCellEditor(FieldModel fm)
          Creates a new JFormattedTextFieldCellEditor with the specified field model.
JFormattedTextFieldCellEditor(int columns)
          Creates a new JFormattedTextFieldCellEditor with the specified column number.
JFormattedTextFieldCellEditor(String text)
          Creates a new JFormattedTextFieldCellEditor with the specified text.
JFormattedTextFieldCellEditor(String text, int columns)
          Creates a new JFormattedTextFieldCellEditor with the specified text and column number.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Invoked when action occurs.
 void addCellEditorListener(CellEditorListener l)
          Adds a CellEditorListener to listener list.
 void cancelCellEditing()
          Cancels editing.
static String Copyright()
          Copyright notice.
protected  void fireEditingCanceled()
          Fires editing canceled event.
protected  void fireEditingStopped()
          Fires editing stopped event.
 void focusGained(FocusEvent e)
          Called when the component gains focus.
 void focusLost(FocusEvent e)
          Called when the component loses focus.
 Object getCellEditorValue()
          Gets the value of the editing cell.
 int getClickCountToStart()
          Gets the ClickCountToStart.
 EventListenerList getListenerList()
          Returns the listener list.
 Border getNoFocusBorder()
          Gets the border of cells without focus.
 Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
          Sets an initial value for the editing.
 boolean isCellEditable(EventObject anEvent)
          Returns true if the editing can be started.
 void removeCellEditorListener(CellEditorListener l)
          Removes a CellEditorListener from listener list.
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 void setNoFocusBorder(Border aBorder)
          Sets the border of the cells without focus.
 boolean shouldSelectCell(EventObject anEvent)
          Indicates whether the editing cell should be selected or not.
protected  boolean startCellEditing(EventObject anEvent)
          Checks whether or not to start the editing, called by isCellEditable(EventObject)
 boolean stopCellEditing()
          Stops the editing.
 
Methods inherited from class com.ibm.etools.iseries.ui.JFormattedTextField
convertInternalToUnformatted, convertUnformattedToInternal, editmaskAttributesChanged, getBackground, getEditmaskAttributes, getEditmaskViewUI, getFieldModel, getInternalValue, getText, getUnformattedText, isValueValid, isValueValidForNumeric, processFocusEvent, setBackground, setEditmaskAttributes, setEditmaskViewUI, setFieldModel, setInternalValue, setText, setUnformattedText
 
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, 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, getToolTipText, 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, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, 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, 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
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

noFocusBorder

protected Border noFocusBorder

changeEvent

protected transient ChangeEvent changeEvent

focusGained

protected boolean focusGained

focusLost

protected boolean focusLost
Constructor Detail

JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor()
Creates a new JFormattedTextFieldCellEditor.


JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor(int columns)
Creates a new JFormattedTextFieldCellEditor with the specified column number.

Parameters:
columns - The number of columns to use to calculate the preferred width.

JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor(FieldModel fm)
Creates a new JFormattedTextFieldCellEditor with the specified field model.

Parameters:
fm - The field model for formatting and validating.

JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor(String text)
Creates a new JFormattedTextFieldCellEditor with the specified text.

Parameters:
text - The initial string to display, or null.

JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor(String text,
                                     int columns)
Creates a new JFormattedTextFieldCellEditor with the specified text and column number.

Parameters:
text - The initial string to display, or null.
columns - The number of columns to use to calculate the preferred width.

JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor(Document doc,
                                     String text,
                                     int columns)
Creates a new JFormattedTextFieldCellEditor with the specified document, text and column number.

Parameters:
doc - The text storage to use.
text - The initial string to display, or null.
columns - The number of columns to use to calculate the preferred width. If columns is set to zero, the preferred width will be whatever naturally results from the component implementation.

JFormattedTextFieldCellEditor

public JFormattedTextFieldCellEditor(Document doc,
                                     String text,
                                     int columns,
                                     FieldModel fm)
Creates a new JFormattedTextFieldCellEditor with the specified document, text, column number and field model.

Parameters:
doc - The text storage to use.
text - The initial string to display, or null.
columns - The number of columns to use to calculate the preferred width. If columns is set to zero, the preferred width will be whatever naturally results from the component implementation.
fm - The field model for formatting and validatting.
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Invoked when action occurs.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - The ActionEvent.

addCellEditorListener

public void addCellEditorListener(CellEditorListener l)
Adds a CellEditorListener to listener list.

Specified by:
addCellEditorListener in interface CellEditor
Parameters:
l - The CellEditorListener to be added.

cancelCellEditing

public void cancelCellEditing()
Cancels editing.

Specified by:
cancelCellEditing in interface CellEditor
See Also:
CellEditor.cancelCellEditing()

Copyright

public static String Copyright()
Copyright notice.

Returns:
java.lang.String

fireEditingCanceled

protected void fireEditingCanceled()
Fires editing canceled event.


fireEditingStopped

protected void fireEditingStopped()
Fires editing stopped event.


focusGained

public void focusGained(FocusEvent e)
Called when the component gains focus.

Specified by:
focusGained in interface FocusListener
Overrides:
focusGained in class JFormattedTextField
Parameters:
e - The FocusEvent

focusLost

public void focusLost(FocusEvent e)
Called when the component loses focus.

Specified by:
focusLost in interface FocusListener
Overrides:
focusLost in class JFormattedTextField
Parameters:
e - The FocusEvent

getCellEditorValue

public Object getCellEditorValue()
Gets the value of the editing cell.

Specified by:
getCellEditorValue in interface CellEditor
See Also:
CellEditor.getCellEditorValue()

getClickCountToStart

public int getClickCountToStart()
Gets the ClickCountToStart.


getListenerList

public EventListenerList getListenerList()
Returns the listener list.

Returns:
javax.swing.event.EventListenerList

getNoFocusBorder

public Border getNoFocusBorder()
Gets the border of cells without focus.

Returns:
javax.swing.border.Border

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Sets an initial value for the editing. The unformatted text will be set.

Specified by:
getTableCellEditorComponent in interface TableCellEditor
See Also:
TableCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)

isCellEditable

public boolean isCellEditable(EventObject anEvent)
Returns true if the editing can be started.

Specified by:
isCellEditable in interface CellEditor
Parameters:
anEvent - the event used to consider whether to begin editing or not.
See Also:
CellEditor.isCellEditable(java.util.EventObject)

removeCellEditorListener

public void removeCellEditorListener(CellEditorListener l)
Removes a CellEditorListener from listener list.

Specified by:
removeCellEditorListener in interface CellEditor
Parameters:
l - The CellEditorListener to be removed.
See Also:
CellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener)

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.

Parameters:
count - an int specifying the number of clicks needed to start editing
See Also:
getClickCountToStart()

setNoFocusBorder

public void setNoFocusBorder(Border aBorder)
Sets the border of the cells without focus.

Parameters:
aBorder - The border to be set.

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)
Indicates whether the editing cell should be selected or not.

Specified by:
shouldSelectCell in interface CellEditor
Parameters:
anEvent - EventObject
See Also:
CellEditor.shouldSelectCell(java.util.EventObject)

startCellEditing

protected boolean startCellEditing(EventObject anEvent)
Checks whether or not to start the editing, called by isCellEditable(EventObject)

Parameters:
anEvent - The event the editor should use to start editing.

stopCellEditing

public boolean stopCellEditing()
Stops the editing.

Specified by:
stopCellEditing in interface CellEditor
Returns:
true if editing was stopped.
See Also:
CellEditor.stopCellEditing()

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.