public class AlternatingTableCellEditor extends Object implements TableCellEditor
Table cell editor which delegates to a number of other editors, switching between
 them in round-robin fashion on each call to getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int).
 This works around rendering issues that occur particularly with JComboBox-based
 cell editors when you try to switch between cells on different rows that would
 be edited using the same JComboBox object, and the "pop-down" of the combo box
 from the previously-edited row is not properly sequenced with the change of model
 and pop-up on the subsequently-edited row.
This class is not thread-safe, but all the method calls happen on the EDT anyway so it doesn't have to be.
The behaviour of this class is as follows:
getTableCellEditorComponent - consecutive calls to this method will
   be forwarded to different underlying editor instancesgetTableCellEditorComponent call.| Constructor and Description | 
|---|
| AlternatingTableCellEditor(TableCellEditor... editors)Create an  AlternatingTableCellEditorthat delegates to
 the specified other editors in round robin order. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addCellEditorListener(CellEditorListener l)Add the specified listener to all the delegate editors. | 
| void | cancelCellEditing() | 
| Object | getCellEditorValue() | 
| Component | getTableCellEditorComponent(JTable table,
                           Object value,
                           boolean isSelected,
                           int row,
                           int column)Switches focus to the next cell editor in the provided list,
 and then passes on the call to that editor. | 
| boolean | isCellEditable(EventObject anEvent) | 
| void | removeCellEditorListener(CellEditorListener l)Remove the specified listener from all the delegate editors. | 
| boolean | shouldSelectCell(EventObject anEvent) | 
| boolean | stopCellEditing() | 
public AlternatingTableCellEditor(TableCellEditor... editors)
AlternatingTableCellEditor that delegates to
 the specified other editors in round robin order.  For a sensible
 user experience all the delegate editors should have identical
 behaviour (they would typically be several instances of the same
 class constructed with the same arguments).editors - the underlying editors to which we will delegate.public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
getTableCellEditorComponent in interface TableCellEditortable - the table being editedvalue - the current value of the cell being editedisSelected - true if the cell is to be rendered with highlightingrow - the row index of the cell being editedcolumn - the column index of the cell being editedpublic Object getCellEditorValue()
getCellEditorValue in interface CellEditorpublic boolean isCellEditable(EventObject anEvent)
isCellEditable in interface CellEditorpublic boolean shouldSelectCell(EventObject anEvent)
shouldSelectCell in interface CellEditorpublic boolean stopCellEditing()
stopCellEditing in interface CellEditorpublic void cancelCellEditing()
cancelCellEditing in interface CellEditorpublic void addCellEditorListener(CellEditorListener l)
addCellEditorListener in interface CellEditorl - the listener to addpublic void removeCellEditorListener(CellEditorListener l)
removeCellEditorListener in interface CellEditorl - the listener to remove.Copyright © 2024 GATE. All rights reserved.