source: src/main/java/genius/core/jtreetable/AbstractCellEditor.java

Last change on this file was 1, checked in by Wouter Pasman, 7 years ago

Initial import : Genius 9.0.0

File size: 2.0 KB
Line 
1package genius.core.jtreetable;
2
3import java.awt.Component;
4import java.awt.event.*;
5import java.awt.AWTEvent;
6import javax.swing.*;
7import javax.swing.event.*;
8import java.util.EventObject;
9import java.io.Serializable;
10
11public class AbstractCellEditor implements CellEditor {
12
13 protected EventListenerList listenerList = new EventListenerList();
14
15 public Object getCellEditorValue() { return null; }
16 public boolean isCellEditable(EventObject e) { return true; }
17 public boolean shouldSelectCell(EventObject anEvent) { return false; }
18 public boolean stopCellEditing() { return true; }
19 public void cancelCellEditing() {}
20
21 public void addCellEditorListener(CellEditorListener l) {
22 listenerList.add(CellEditorListener.class, l);
23 }
24
25 public void removeCellEditorListener(CellEditorListener l) {
26 listenerList.remove(CellEditorListener.class, l);
27 }
28
29 /*
30 * Notify all listeners that have registered interest for
31 * notification on this event type.
32 * @see EventListenerList
33 */
34 protected void fireEditingStopped() {
35 // Guaranteed to return a non-null array
36 Object[] listeners = listenerList.getListenerList();
37 // Process the listeners last to first, notifying
38 // those that are interested in this event
39 for (int i = listeners.length-2; i>=0; i-=2) {
40 if (listeners[i]==CellEditorListener.class) {
41 ((CellEditorListener)listeners[i+1]).editingStopped(new ChangeEvent(this));
42 }
43 }
44 }
45
46 /*
47 * Notify all listeners that have registered interest for
48 * notification on this event type.
49 * @see EventListenerList
50 */
51 protected void fireEditingCanceled() {
52 // Guaranteed to return a non-null array
53 Object[] listeners = listenerList.getListenerList();
54 // Process the listeners last to first, notifying
55 // those that are interested in this event
56 for (int i = listeners.length-2; i>=0; i-=2) {
57 if (listeners[i]==CellEditorListener.class) {
58 ((CellEditorListener)listeners[i+1]).editingCanceled(new ChangeEvent(this));
59 }
60 }
61 }
62}
Note: See TracBrowser for help on using the repository browser.