javax.swing
Class DefaultCellEditor.EditorDelegate

java.lang.Object
  extended by javax.swing.DefaultCellEditor.EditorDelegate
All Implemented Interfaces:
ActionListener, ItemListener, Serializable, EventListener
Enclosing class:
DefaultCellEditor

protected class DefaultCellEditor.EditorDelegate
extends Object
implements ActionListener, ItemListener, Serializable

This changeable module access the editor component in the component specific way. For instance, to set the value for JTextField, we need to call setText(String), and for JCheckBox we need to call setSelected(boolean). Each default editor has the component specific derivative of this class. These derivatives are private inner classes of the DefaultCellEditor. The editor delegate is also set for the editor component as the action listener. It listens for the events that indicate that editing has stopped.

See Also:
Serialized Form

Field Summary
protected  Object value
          The object value (updated when getting and setting the value).
 
Constructor Summary
protected DefaultCellEditor.EditorDelegate()
          Constructor EditorDelegate
 
Method Summary
 void actionPerformed(ActionEvent event)
          This event is fired by the editor component (for instance, by pressing ENTER in the JTextField.
 void cancelCellEditing()
          Cancel the cell editing session.
 Object getCellEditorValue()
          Get the value for the editor component.
 boolean isCellEditable(EventObject event)
          The default method returns true for the MouseEvent and false for any other events.
 void itemStateChanged(ItemEvent event)
          This event is fired by the editor component.The default method delegates call to the stopCellEditing(), finishing the editing session.
 void setValue(Object aValue)
          Set the value for the editor component.
 boolean shouldSelectCell(EventObject event)
          Returns true to indicate that the editing cell can be selected.
 boolean startCellEditing(EventObject event)
          Start editing session and returns true to indicate the editing has begun.
 boolean stopCellEditing()
          Finish the cell editing session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected Object value
The object value (updated when getting and setting the value).

Constructor Detail

DefaultCellEditor.EditorDelegate

protected DefaultCellEditor.EditorDelegate()
Constructor EditorDelegate

Method Detail

setValue

public void setValue(Object aValue)
Set the value for the editor component. This method is normally overridden to set the value in the way, specific for the text component, check box or combo box.

Parameters:
aValue - the value to set (String, Boolean or Number).

getCellEditorValue

public Object getCellEditorValue()
Get the value for the editor component. This method is normally overridden to obtain the value in the way, specific for the text component, check box or combo box.

Returns:
value the value of the component (String, Boolean or Number).

isCellEditable

public boolean isCellEditable(EventObject event)
The default method returns true for the MouseEvent and false for any other events.

Parameters:
event - the event to check
Returns:
true if the passed event is the mouse event and false otherwise.

shouldSelectCell

public boolean shouldSelectCell(EventObject event)
Returns true to indicate that the editing cell can be selected. The default method returns true without action but may be overridden in derived classes for more specific behavior.

Parameters:
event - unused in default method
Returns:
true always

stopCellEditing

public boolean stopCellEditing()
Finish the cell editing session. This method notifies the registered cell editor listeners (including the table) that the editing has been stopped.

Returns:
boolean

cancelCellEditing

public void cancelCellEditing()
Cancel the cell editing session. This method notifies the registered cell editor listeners (including the table) that the editing has been canceled.


startCellEditing

public boolean startCellEditing(EventObject event)
Start editing session and returns true to indicate the editing has begun. The default method returns true without action but may be overridden in derived classes for more specific behavior.

Parameters:
event - the event.
Returns:
true, always

actionPerformed

public void actionPerformed(ActionEvent event)
This event is fired by the editor component (for instance, by pressing ENTER in the JTextField. The default method delegates call to the stopCellEditing(), finishing the editing session.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - unused in default method

itemStateChanged

public void itemStateChanged(ItemEvent event)
This event is fired by the editor component.The default method delegates call to the stopCellEditing(), finishing the editing session.

Specified by:
itemStateChanged in interface ItemListener
Parameters:
event - unused in default method