JClass 4.5.0 API
Documentation

com.klg.jclass.field.cell
Class JCTextFieldCellEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
                          |
                          +--javax.swing.JTextField
                                |
                                +--com.klg.jclass.field.JCTextField
                                      |
                                      +--com.klg.jclass.field.cell.JCTextFieldCellEditor

public class JCTextFieldCellEditor
extends JCTextField
implements com.klg.jclass.cell.JCCellEditor, com.klg.jclass.cell.JCValidateInterface, KeyListener, MouseListener

JCTextFieldCellEditor provides an editor using a simple JCTextField component.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JTextField
JTextField.AccessibleJTextField
 
Inner classes inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
protected  int caretPosition
           
protected  Object data
          This editor can dynamically alter its reserved key list based upon the key the user has last typed.
protected  AWTEvent initialEvent
           
protected  com.klg.jclass.cell.JCKeyModifier[] reservedKeys
           
protected  boolean selectAll
           
protected  com.klg.jclass.cell.JCCellEditorSupport support
           
protected  com.klg.jclass.cell.validate.ValidateSupport validate_support
           
 
Fields inherited from class com.klg.jclass.field.JCTextField
field, required, version
 
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
 
Constructor Summary
JCTextFieldCellEditor()
          Creates a new JCTextFieldCellEditor object.
JCTextFieldCellEditor(Class c, JCValidator v)
          Constructs an empty JCTextFieldCellEditor which expects an object of the specified class; which uses the specified validator
 
Method Summary
 void addCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
          Add a listener to the list that's notified when the editor starts, stops, or cancels editing.
 void addValidateListener(com.klg.jclass.cell.validate.JCValidateListener l)
          Add a new ValidateListener to the list.
 void cancelCellEditing()
          Called when the edit process is cancelled.
protected  boolean fireValidated(com.klg.jclass.cell.validate.JCValidateEvent ev)
           
 Object getCellEditorValue()
          Returns the object to be commited.
 Component getComponent()
          Returns the JCTextField component.
 Dimension getPreferredSize(Graphics gc, com.klg.jclass.cell.JCCellInfo cellInfo, Object o)
           
 com.klg.jclass.cell.JCKeyModifier[] getReservedKeys()
          This editor reserves the LEFT and RIGHT arrow keys for its own use.
 void initialize(AWTEvent ev, com.klg.jclass.cell.JCCellInfo info, Object o)
           
 boolean isModified()
          Returns true if the data has been modified.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void processKeyEvent(KeyEvent e)
           
 void removeCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
          Remove a listener from the list that's notified
 void removeValidateListener(com.klg.jclass.cell.validate.JCValidateListener l)
          Remove a ValidateListener from the list.
 void selectAllText()
          Uses hint from CellInfo to select all the text in the component.
 void setVisible(boolean b)
          Overrides setVisible in order to control the caret position.
 boolean stopCellEditing()
          Called when the edit process is stopped
 
Methods inherited from class com.klg.jclass.field.JCTextField
addNotify, addPropertyChangeListener, addValueListener, commitEdit, createField, getAbout, getDataProperties, getInvalidInfo, getSelectOnEnter, getState, getValidator, getValue, getValueModel, isRequired, removePropertyChangeListener, removeValueListener, setAbout, setBackground, setDataProperties, setForeground, setInvalidInfo, setRequired, setSelectOnEnter, setValidator, setValue, setValueModel
 
Methods inherited from class javax.swing.JTextField
addActionListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setActionCommand, setColumns, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretPosition, getDisabledTextColor, getDocument, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getUI, isEditable, isFocusTraversable, isOpaque, loadKeymap, modelToView, moveCaretPosition, paste, processComponentKeyEvent, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setDisabledTextColor, setDocument, setEditable, setEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setOpaque, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processFocusEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected Object data
This editor can dynamically alter its reserved key list based upon the key the user has last typed. Thus, typing navigation keys will cause the cell editor to traverse, but after typing a non-navigation key, the user is placed into edit mode. At that point, the reserved keys are re-enabled and the traversal keys will traverse within the editor itself. The only way to get out of edit mode is to press Enter, Escape, or use the mouse to click on another cell.

caretPosition

protected int caretPosition

initialEvent

protected AWTEvent initialEvent

support

protected com.klg.jclass.cell.JCCellEditorSupport support

selectAll

protected boolean selectAll

reservedKeys

protected com.klg.jclass.cell.JCKeyModifier[] reservedKeys

validate_support

protected com.klg.jclass.cell.validate.ValidateSupport validate_support
Constructor Detail

JCTextFieldCellEditor

public JCTextFieldCellEditor()
Creates a new JCTextFieldCellEditor object.

JCTextFieldCellEditor

public JCTextFieldCellEditor(Class c,
                             JCValidator v)
Constructs an empty JCTextFieldCellEditor which expects an object of the specified class; which uses the specified validator
Method Detail

initialize

public void initialize(AWTEvent ev,
                       com.klg.jclass.cell.JCCellInfo info,
                       Object o)
Specified by:
initialize in interface com.klg.jclass.cell.JCCellEditor

getComponent

public Component getComponent()
Returns the JCTextField component.
Specified by:
getComponent in interface com.klg.jclass.cell.JCCellEditor

getCellEditorValue

public Object getCellEditorValue()
Returns the object to be commited.
Specified by:
getCellEditorValue in interface com.klg.jclass.cell.JCCellEditor

isModified

public boolean isModified()
Returns true if the data has been modified.
Specified by:
isModified in interface com.klg.jclass.cell.JCCellEditor

fireValidated

protected boolean fireValidated(com.klg.jclass.cell.validate.JCValidateEvent ev)

stopCellEditing

public boolean stopCellEditing()
Called when the edit process is stopped
Specified by:
stopCellEditing in interface com.klg.jclass.cell.JCCellEditor

cancelCellEditing

public void cancelCellEditing()
Called when the edit process is cancelled.
Specified by:
cancelCellEditing in interface com.klg.jclass.cell.JCCellEditor

getPreferredSize

public Dimension getPreferredSize(Graphics gc,
                                  com.klg.jclass.cell.JCCellInfo cellInfo,
                                  Object o)

getReservedKeys

public com.klg.jclass.cell.JCKeyModifier[] getReservedKeys()
This editor reserves the LEFT and RIGHT arrow keys for its own use. However, after the edit comitted or cancelled, it temporarily "unreserves" these keys.
Specified by:
getReservedKeys in interface com.klg.jclass.cell.JCCellEditor

setVisible

public void setVisible(boolean b)
Overrides setVisible in order to control the caret position.
Overrides:
setVisible in class JComponent

addCellEditorListener

public void addCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
Add a listener to the list that's notified when the editor starts, stops, or cancels editing.
Parameters:
l - the CellEditorListener

removeCellEditorListener

public void removeCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
Remove a listener from the list that's notified
Parameters:
l - the CellEditorListener

processKeyEvent

public void processKeyEvent(KeyEvent e)
Overrides:
processKeyEvent in class JComponent

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

selectAllText

public void selectAllText()
Uses hint from CellInfo to select all the text in the component.

addValidateListener

public void addValidateListener(com.klg.jclass.cell.validate.JCValidateListener l)
Add a new ValidateListener to the list.
Specified by:
addValidateListener in interface com.klg.jclass.cell.JCValidateInterface

removeValidateListener

public void removeValidateListener(com.klg.jclass.cell.validate.JCValidateListener l)
Remove a ValidateListener from the list.
Specified by:
removeValidateListener in interface com.klg.jclass.cell.JCValidateInterface

Copyright© 1999-2000 KL Group Inc.
All rights reserved.