JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.cell.editors
Class BaseCellEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
                          |
                          +--javax.swing.JTextField
                                |
                                +--com.klg.jclass.cell.editors.BaseCellEditor
All Implemented Interfaces:
Accessible, EventListener, FocusListener, ImageObserver, JCCellEditor, JCCellEditorEventSource, JCCellTextEditor, JCValidateInterface, KeyListener, MenuContainer, MouseListener, Scrollable, Serializable, SwingConstants
Direct Known Subclasses:
JCBigDecimalCellEditor, JCBooleanCellEditor, JCByteCellEditor, JCDateCellEditor, JCDoubleCellEditor, JCFloatCellEditor, JCIntegerCellEditor, JCLongCellEditor, JCShortCellEditor, JCSqlDateCellEditor, JCSqlTimeCellEditor, JCSqlTimestampCellEditor, JCStringCellEditor

public class BaseCellEditor
extends JTextField
implements JCCellTextEditor, JCValidateInterface, KeyListener, MouseListener, FocusListener

BaseCellEditor provides a simple text editing 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 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
BaseCellEditor()
          Default constructor
 
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)
           
 void focusGained(FocusEvent event)
           
 void focusLost(FocusEvent event)
           
 String getCellEditorText()
          Gets the text for the editor (as a String)
 Object getCellEditorValue()
          Returns the object to be commited.
 Component getComponent()
          Returns the edit 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
protected  void initData()
           
 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)
          Override the key event processor.
 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 requestFocus()
           
 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 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, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
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, 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, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, 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, 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, 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

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

BaseCellEditor

public BaseCellEditor()
Default constructor

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:
The value of selectAll

getComponent

public Component getComponent()
Returns the edit component.

Specified by:
getComponent in interface JCCellEditor
Returns:
The current edit 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:
Has 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:
true if current cell editor value passes validation

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:
keys that the editor would like to reserve for itself

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.

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

removeCellEditorListener

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

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

processKeyEvent

public void processKeyEvent(KeyEvent e)
Override the key event processor. This allows the parent to pass a key event to this editor that 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

initData

protected void initData()

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 JCValidateInterface
Parameters:
l -

removeValidateListener

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

Specified by:
removeValidateListener in interface JCValidateInterface
Parameters:
l -

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

focusGained

public void focusGained(FocusEvent event)
Specified by:
focusGained in interface FocusListener

focusLost

public void focusLost(FocusEvent event)
Specified by:
focusLost in interface FocusListener

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