com.eliad.model.defaults
Class DefaultGridCellEditor

java.lang.Object
  |
  +--javax.swing.AbstractCellEditor
        |
        +--com.eliad.model.defaults.DefaultGridCellEditor
Direct Known Subclasses:
DefaultStyleModel.BooleanEditor, DefaultStyleModel.GenericEditor

public class DefaultGridCellEditor
extends javax.swing.AbstractCellEditor
implements GridCellEditor

The default editor for a GridCellEditor and DefaultStyleModel.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Version:
1.0
Author:
Stephan Szymkowicz
See Also:
GridCellEditor, java.swing.CellEditor, DefaultStyleModel, Serialized Form

Inner Class Summary
protected  class DefaultGridCellEditor.EditorDelegate
           
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
DefaultGridCellEditor(javax.swing.JCheckBox checkBox)
          Constructs a DefaultGridCellEditor object that uses a check box.
DefaultGridCellEditor(javax.swing.JComboBox comboBox)
          Constructs a DefaultGridCellEditor object that uses a combo box.
DefaultGridCellEditor(javax.swing.JTextField textField)
          Constructs a DefaultGridCellEditor that uses a text field.
 
Method Summary
 void cancelCellEditing()
          Tells the editor to cancel editing and not to accept any partially edited value.
 java.lang.Object getCellEditorValue()
          Returns the value of the editing component as an Object Forwards method to our delegate.
 int getClickCountToStart()
          Returns the number of clicks required to start editing.
 java.awt.Component getComponent()
          Returns the a reference to the editor component.
 java.awt.Component getComponent(java.lang.Object value, boolean isSelected, int row, int column, GridContext gridContext)
           
 boolean isCellEditable(java.util.EventObject anEvent)
          Asks the editor if it can start editing using anEvent.
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 boolean shouldSelectCell(java.util.EventObject anEvent)
          Asks the editor whether the editing cell should be selected using anEvent.
 boolean stopCellEditing()
          Tells the editor to stop editing and to accept any partially edited value as the value of the editor.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, removeCellEditorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGridCellEditor

public DefaultGridCellEditor(javax.swing.JTextField textField)
Constructs a DefaultGridCellEditor that uses a text field.
Parameters:
x - a JTextField object ...

DefaultGridCellEditor

public DefaultGridCellEditor(javax.swing.JCheckBox checkBox)
Constructs a DefaultGridCellEditor object that uses a check box.
Parameters:
x - a JCheckBox object ...

DefaultGridCellEditor

public DefaultGridCellEditor(javax.swing.JComboBox comboBox)
Constructs a DefaultGridCellEditor object that uses a combo box.
Parameters:
x - a JComboBox object ...
Method Detail

getComponent

public java.awt.Component getComponent()
Returns the a reference to the editor component.
Returns:
the editor Component

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.
Parameters:
count - an int specifying the number of clicks needed to start editing
See Also:
getClickCountToStart()

getClickCountToStart

public int getClickCountToStart()
Returns the number of clicks required to start editing.

getCellEditorValue

public java.lang.Object getCellEditorValue()
Returns the value of the editing component as an Object Forwards method to our delegate.
Returns:
an Object which is the edited value
Overrides:
getCellEditorValue in class javax.swing.AbstractCellEditor

isCellEditable

public boolean isCellEditable(java.util.EventObject anEvent)
Asks the editor if it can start editing using anEvent. Forwards method to our delegate.
Parameters:
e - an event object
Overrides:
isCellEditable in class javax.swing.AbstractCellEditor

shouldSelectCell

public boolean shouldSelectCell(java.util.EventObject anEvent)
Asks the editor whether the editing cell should be selected using anEvent. Forwards method to our delegate.
Parameters:
e - an event object
Overrides:
shouldSelectCell in class javax.swing.AbstractCellEditor

stopCellEditing

public boolean stopCellEditing()
Tells the editor to stop editing and to accept any partially edited value as the value of the editor. Forwards method to our delegate.
Overrides:
stopCellEditing in class javax.swing.AbstractCellEditor

cancelCellEditing

public void cancelCellEditing()
Tells the editor to cancel editing and not to accept any partially edited value. Forwards method to our delegate.
Overrides:
cancelCellEditing in class javax.swing.AbstractCellEditor

getComponent

public java.awt.Component getComponent(java.lang.Object value,
                                       boolean isSelected,
                                       int row,
                                       int column,
                                       GridContext gridContext)
Specified by:
getComponent in interface GridCellEditor