javax.swing

Class AbstractCellEditor

public abstract class AbstractCellEditor extends Object implements CellEditor, Serializable

An abstract superclass for table and tree cell editors. This provides some common shared functionality.
Field Summary
protected ChangeEventchangeEvent
The cached ChangeEvent.
protected EventListenerListlistenerList
Our Swing event listeners.
Constructor Summary
AbstractCellEditor()
Creates a new instance of AbstractCellEditor.
Method Summary
voidaddCellEditorListener(CellEditorListener listener)
Adds a CellEditorListener to the list of CellEditorListeners of this CellEditor.
voidcancelCellEditing()
Stop editing the cell and do not accept any partial value that has been entered into the cell.
protected voidfireEditingCanceled()
Notifies all registered listeners that the editing of the cell has has been canceled.
protected voidfireEditingStopped()
Notifies all registered listeners that the editing of the cell has has been stopped.
CellEditorListener[]getCellEditorListeners()
Returns the list of CellEditorListeners that have been registered in this CellEditor.
booleanisCellEditable(EventObject event)
Returns true if the cell is editable using event, false if it's not.
voidremoveCellEditorListener(CellEditorListener listener)
Removes the specified CellEditorListener from the list of the CellEditorListeners of this CellEditor.
booleanshouldSelectCell(EventObject event)
Returns true if the editing cell should be selected, false otherwise.
booleanstopCellEditing()
Stop editing the cell and accept any partial value that has been entered into the cell.

Field Detail

changeEvent

protected transient ChangeEvent changeEvent
The cached ChangeEvent.

listenerList

protected EventListenerList listenerList
Our Swing event listeners.

Constructor Detail

AbstractCellEditor

public AbstractCellEditor()
Creates a new instance of AbstractCellEditor.

Method Detail

addCellEditorListener

public void addCellEditorListener(CellEditorListener listener)
Adds a CellEditorListener to the list of CellEditorListeners of this CellEditor.

Parameters: listener the CellEditorListener to add

cancelCellEditing

public void cancelCellEditing()
Stop editing the cell and do not accept any partial value that has been entered into the cell.

fireEditingCanceled

protected void fireEditingCanceled()
Notifies all registered listeners that the editing of the cell has has been canceled.

fireEditingStopped

protected void fireEditingStopped()
Notifies all registered listeners that the editing of the cell has has been stopped.

getCellEditorListeners

public CellEditorListener[] getCellEditorListeners()
Returns the list of CellEditorListeners that have been registered in this CellEditor.

Returns: the list of CellEditorListeners that have been registered in this CellEditor

Since: 1.4

isCellEditable

public boolean isCellEditable(EventObject event)
Returns true if the cell is editable using event, false if it's not. The default behaviour is to return true.

Parameters: event an event

Returns: true if the cell is editable using event, false if it's not

removeCellEditorListener

public void removeCellEditorListener(CellEditorListener listener)
Removes the specified CellEditorListener from the list of the CellEditorListeners of this CellEditor.

Parameters: listener the CellEditorListener to remove

shouldSelectCell

public boolean shouldSelectCell(EventObject event)
Returns true if the editing cell should be selected, false otherwise. This is usually returning true, but in some special cases it might be useful not to switch cell selection when editing one cell.

Parameters: event an event

Returns: true if the editing cell should be selected, false otherwise

stopCellEditing

public boolean stopCellEditing()
Stop editing the cell and accept any partial value that has been entered into the cell.

Returns: true if editing has been stopped successfully, falseotherwise