Class DefaultCellEditor

java.lang.Object
javax.swing.AbstractCellEditor
vaadinx.swing.DefaultCellEditor
All Implemented Interfaces:
Serializable, CellEditor, TableCellEditor, TreeCellEditor

public class DefaultCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor
Port of DefaultCellEditor — the stock cell editor over a JTextField, JComboBox, or JCheckBox. Body ported faithfully (R_swing_is_truth) from the JDK class: same three ctors, same EditorDelegate shape, same clickCountToStart defaults (2 for text field, 1 for combo and check box).

Layering: this is an emulator-only type (confirmed 2026-07-07, see D_jtable_cell_editing in emulators/decisions.md). It is inherently stage-2 / Swing-shaped — its ctors take emulator components and getTableCellEditorComponent(JTable, Object, boolean, int, int) returns Component. Stage-3 (pure-surrogate) code edits via the Vaadin Grid.Editor that SJTable inherits, not through this class.

Reuse boundary: extends the JDK AbstractCellEditor (which references no java.awt.Component, so it is reused unchanged per D_whitelist_porting — it carries the CellEditorListener list + fireEditingStopped/fireEditingCanceled plumbing) and implements the ported TableCellEditor + TreeCellEditor.

The EditorDelegate registers itself as an ActionListener on the editor component; because the emulator JTextField/JComboBox/JCheckBox fire real Swing ActionEvents via their R_swing_is_truth peer bridges, a commit on the editor component (JTextField Enter, combo selection) fans out to the CellEditorListeners with no Grid involved — which is what lets this class be unit-tested in isolation ahead of the JTable Grid.Editor bridge.

See Also:
  • Field Details

    • editorComponent

      protected JComponent editorComponent
      The editing component; set by one of the three type-specific ctors.
    • delegate

      Bridges the editor component's value in/out and translates its action/item events into stopCellEditing calls. A type-specific subclass instance is created by each ctor.
    • clickCountToStart

      protected int clickCountToStart
      Clicks needed to start editing: 2 for a text field, 1 for combo/check box.
  • Constructor Details

    • DefaultCellEditor

      public DefaultCellEditor(JTextField textField)
    • DefaultCellEditor

      public DefaultCellEditor(JCheckBox checkBox)
    • DefaultCellEditor

      public DefaultCellEditor(JComboBox<?> comboBox)
  • Method Details