JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.cell
Interface JCCellEditor

All Superinterfaces:
JCCellEditorEventSource, Serializable
All Known Subinterfaces:
JCCellTextEditor
All Known Implementing Classes:
BaseCellEditor, JCCheckBoxCellEditor, JCComboBoxCellEditor, JCComboFieldCellEditor, JCImageCellEditor, JCMultilineCellEditor, JCPopupFieldCellEditor, JCSpinFieldCellEditor, JCTextFieldCellEditor, NullCellEditor

public interface JCCellEditor
extends JCCellEditorEventSource, Serializable

The JCCellEditor interface allows objects to specify custom cell editors.

A cell editor is essentially an AWT component, but the cell editor interface adds functions that allow the container to initialize, commit, or cancel the edit.

Special note: If an editor contains multiple AWT components, it is important that all key events migrate to the component returned by getComponent(). Most containers listen for key events on this component in order to determine whether to traverse or cancel.


Method Summary
 void cancelCellEditing()
          Cancels the edit.
 Object getCellEditorValue()
          Returns the value contained in the editor.
 Component getComponent()
          Returns the actual component that will be used to do the editing.
 com.klg.jclass.cell.JCKeyModifier[] getReservedKeys()
          Retrieves the keys that the editor would like to reserve for itself.
 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()
          Determines whether any changes have been made.
 boolean stopCellEditing()
          Terminates editing, accepting any partially-edited value as the value of the editor.
 
Methods inherited from interface com.klg.jclass.cell.JCCellEditorEventSource
addCellEditorListener, removeCellEditorListener
 

Method Detail

initialize

public 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).
Note: The size of the cell comes from info.getDrawingArea().

Implementors must handle null AWTEvents.

Parameters:
ev - event that initiated the edit operation
info - cell that displays information for the editor
o - item to be edited

getComponent

public Component getComponent()
Returns the actual component that will be used to do the editing. Typically, the JCCellEditor will extend an Swing component and implement the JCCellEditor interface, so getComponent() usually returns 'this'.

Returns:
actual component that will be used to do the editing

getCellEditorValue

public Object getCellEditorValue()
Returns the value contained in the editor.

Returns:
value contained in the editor

stopCellEditing

public boolean stopCellEditing()
Terminates editing, accepting any partially-edited value as the value of the editor. The editor should return false if editing was not stopped; this is useful for value-validating editors that cannot accept invalid edits.

Returns:
true if editing was stopped

isModified

public boolean isModified()
Determines whether any changes have been made. When the container wants to commit the edit, it should call the JCCellEditor's isModified() method to determine whether any changes have been made.

Returns:

cancelCellEditing

public void cancelCellEditing()
Cancels the edit. When the container wants to cancel the edit and discard any changes, it should call cancel().
Note: JCCellEditor.cancel() should never be called from within a cell editor.


getReservedKeys

public com.klg.jclass.cell.JCKeyModifier[] getReservedKeys()
Retrieves the keys that the editor would like to reserve for itself. JDK event handling does not allow the order of event processing to be specified. This makes it possible for the container to override key processing in the editor. To avoid this, the editor can pass back a list of keys it wishes to reserve.
Note: The container can choose whether to honor the editor's attempt to reserve the keys.

Most editors can simply return null.

Returns:
keys that the editor would like to reserve for itself

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