1 19 20 24 package org.netbeans.modules.tasklist.usertasks.treetable; 25 26 import java.util.EventObject ; 27 28 import javax.swing.CellEditor ; 29 import javax.swing.event.CellEditorListener ; 30 import javax.swing.event.ChangeEvent ; 31 import javax.swing.event.EventListenerList ; 32 33 36 public class AbstractCellEditor implements CellEditor { 37 38 protected EventListenerList listenerList = new EventListenerList (); 39 40 public Object getCellEditorValue() { return null; } 41 public boolean isCellEditable(EventObject e) { return true; } 42 public boolean shouldSelectCell(EventObject anEvent) { return false; } 43 public boolean stopCellEditing() { return true; } 44 public void cancelCellEditing() {} 45 46 public void addCellEditorListener(CellEditorListener l) { 47 listenerList.add(CellEditorListener .class, l); 48 } 49 50 public void removeCellEditorListener(CellEditorListener l) { 51 listenerList.remove(CellEditorListener .class, l); 52 } 53 54 59 protected void fireEditingStopped() { 60 Object [] listeners = listenerList.getListenerList(); 62 for (int i = listeners.length-2; i>=0; i-=2) { 65 if (listeners[i]==CellEditorListener .class) { 66 ((CellEditorListener )listeners[i+1]).editingStopped( 67 new ChangeEvent (this)); 68 } 69 } 70 } 71 72 77 protected void fireEditingCanceled() { 78 Object [] listeners = listenerList.getListenerList(); 80 for (int i = listeners.length-2; i>=0; i-=2) { 83 if (listeners[i]==CellEditorListener .class) { 84 ((CellEditorListener )listeners[i+1]).editingCanceled( 85 new ChangeEvent (this)); 86 } 87 } 88 } 89 } 90 | Popular Tags |