JClass DesktopViews 6.3.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
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, JCCellEditor, JCCellEditorEventSource, JCCellTextEditor, JCFieldComponent, JCValidateInterface, KeyListener, MenuContainer, MouseListener, Scrollable, Serializable, SwingConstants

public class JCTextFieldCellEditor
extends JCTextField
implements JCCellTextEditor, JCValidateInterface, KeyListener, MouseListener

JCTextFieldCellEditor provides an editor using a simple JCTextField component.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTextField
JTextField.AccessibleJTextField
 
Nested classes inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
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
 
Fields inherited from interface com.klg.jclass.field.JCFieldComponent
INVALID, UNDEREDIT, VALID
 
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
JCTextFieldCellEditor()
          Creates a new JCTextFieldCellEditor object.
JCTextFieldCellEditor(Class c, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCTextFieldCellEditor, which expects an object of the specified class, that uses the specified validator.
 
Method Summary
 void addCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
          Adds 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)
          Adds 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)
           
 String getCellEditorText()
          Gets the text for the editor (as a String).
 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.
 boolean getSelectAll()
          Returns whether this editor will select the text on initialization.
 void initialize(AWTEvent ev, com.klg.jclass.cell.JCCellInfo info, Object o)
          The container calls initialize() before the edit starts to let the editor know what kind of event started the edit (via the AWTEvent object).
 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)
          Overrides the key event processor.
 void removeCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
          Removes a listener from the list that's notified.
 void removeValidateListener(com.klg.jclass.cell.validate.JCValidateListener l)
          Removes a ValidateListener from the list.
 void selectAllText()
          Uses hint from CellInfo to select all the text in the component.
 void setCellEditorText(String text)
          Sets the text for the editor.
 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, setEditable, setForeground, setInvalidInfo, setLocale, setRequired, setSelectOnEnter, setValidator, setValue, setValueModel
 
Methods inherited from class javax.swing.JTextField
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, 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, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, 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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, 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

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 or 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,
                             com.klg.jclass.field.validate.JCValidator v)
Constructs an empty JCTextFieldCellEditor, which expects an object of the specified class, that uses the specified validator.

Parameters:
c - the class type the editor will expect
v - the validator that validates input in the editor
Method Detail

initialize

public void initialize(AWTEvent ev,
                       com.klg.jclass.cell.JCCellInfo info,
                       Object o)
Description copied from interface: JCCellEditor
The container calls initialize() before the edit starts to let the editor know what kind of event started the edit (via the AWTEvent object).
Note: The size of the cell comes from info.getDrawingArea().

Implementors must handle null AWTEvents.

Specified by:
initialize in interface JCCellEditor
Parameters:
ev - event that initiated the edit operation
info - cell that displays information for the editor
o - item to be edited

getSelectAll

public boolean getSelectAll()
Returns whether this editor will select the text on initialization.

Specified by:
getSelectAll in interface JCCellTextEditor
Returns:
true if text is selected on initialization

getComponent

public Component getComponent()
Returns the JCTextField component.

Specified by:
getComponent in interface JCCellEditor
Returns:
the current JCTextField component

getCellEditorValue

public Object getCellEditorValue()
Returns the object to be commited.

Specified by:
getCellEditorValue in interface JCCellEditor
Returns:
the current cell editor value

getCellEditorText

public String getCellEditorText()
Gets the text for the editor (as a String).

Specified by:
getCellEditorText in interface JCCellTextEditor
Returns:
the current text in the editor

setCellEditorText

public void setCellEditorText(String text)
Sets the text for the editor.

Specified by:
setCellEditorText in interface JCCellTextEditor
Parameters:
text - the new cell editor text value

isModified

public boolean isModified()
Returns true if the data has been modified.

Specified by:
isModified in interface JCCellEditor
Returns:
if the data been modified

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 JCCellEditor
Returns:
whether validation succeeded

cancelCellEditing

public void cancelCellEditing()
Called when the edit process is cancelled.

Specified by:
cancelCellEditing in interface 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 JCCellEditor
Returns:
a list of reserved keys

setVisible

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

Overrides:
setVisible in class JComponent
Parameters:
b - the new value of visible

addCellEditorListener

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

Specified by:
addCellEditorListener in interface JCCellEditorEventSource
Parameters:
l - the CellEditorListener

removeCellEditorListener

public void removeCellEditorListener(com.klg.jclass.cell.JCCellEditorListener l)
Removes a listener from the list that's notified.

Specified by:
removeCellEditorListener in interface JCCellEditorEventSource
Parameters:
l - the CellEditorListener

processKeyEvent

public void processKeyEvent(KeyEvent e)
Overrides the key event processor. This allows the parent to pass a key event to this editor, which it might otherwise not get.

Specified by:
processKeyEvent in interface JCCellTextEditor
Overrides:
processKeyEvent in class JComponent
Parameters:
e - the event to pass

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)
Adds a new ValidateListener to the list.

Specified by:
addValidateListener in interface JCValidateInterface
Parameters:
l - the listener to be added

removeValidateListener

public void removeValidateListener(com.klg.jclass.cell.validate.JCValidateListener l)
Removes a ValidateListener from the list.

Specified by:
removeValidateListener in interface JCValidateInterface
Parameters:
l - the listener to be removed

Copyright © 2004 Quest Software Inc..
All rights reserved.