Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

AbstractCellEditor.java

00001 /*
00002  * %W% %E%
00003  *
00004  * Copyright 1997, 1998 Sun Microsystems, Inc. All Rights Reserved.
00005  * 
00006  * Redistribution and use in source and binary forms, with or
00007  * without modification, are permitted provided that the following
00008  * conditions are met:
00009  * 
00010  * - Redistributions of source code must retain the above copyright
00011  *   notice, this list of conditions and the following disclaimer. 
00012  *   
00013  * - Redistribution in binary form must reproduce the above
00014  *   copyright notice, this list of conditions and the following
00015  *   disclaimer in the documentation and/or other materials
00016  *   provided with the distribution. 
00017  *   
00018  * Neither the name of Sun Microsystems, Inc. or the names of
00019  * contributors may be used to endorse or promote products derived
00020  * from this software without specific prior written permission.  
00021  * 
00022  * This software is provided "AS IS," without a warranty of any
00023  * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
00024  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
00025  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
00026  * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
00027  * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
00028  * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE OR
00029  * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE 
00030  * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,   
00031  * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER  
00032  * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF 
00033  * THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS 
00034  * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00035  * 
00036  * You acknowledge that this software is not designed, licensed or
00037  * intended for use in the design, construction, operation or
00038  * maintenance of any nuclear facility.
00039  */
00040 package GuiComponents.Inspector.TreeTable;
00041 
00042 import java.awt.Component;
00043 import java.awt.event.*;
00044 import java.awt.AWTEvent;
00045 import javax.swing.*;
00046 import javax.swing.event.*;
00047 import java.util.EventObject;
00048 import java.io.Serializable;
00049 
00060 public class AbstractCellEditor implements CellEditor {
00061 
00062     protected EventListenerList listenerList = new EventListenerList();
00063 
00064     public Object getCellEditorValue() { return null; }
00065     public boolean isCellEditable(EventObject e) { return true; }
00066     public boolean shouldSelectCell(EventObject anEvent) { return false; }
00067     public boolean stopCellEditing() { return true; }
00068     public void cancelCellEditing() {}
00069 
00070     public void addCellEditorListener(CellEditorListener l) {
00071         listenerList.add(CellEditorListener.class, l);
00072     }
00073 
00074     public void removeCellEditorListener(CellEditorListener l) {
00075         listenerList.remove(CellEditorListener.class, l);
00076     }
00077 
00083     protected void fireEditingStopped() {
00084         // Guaranteed to return a non-null array
00085         Object[] listeners = listenerList.getListenerList();
00086         // Process the listeners last to first, notifying
00087         // those that are interested in this event
00088         for (int i = listeners.length-2; i>=0; i-=2) {
00089             if (listeners[i]==CellEditorListener.class) {
00090                 ((CellEditorListener)listeners[i+1]).editingStopped(new ChangeEvent(this));
00091             }          
00092         }
00093     }
00094 
00100     protected void fireEditingCanceled() {
00101         // Guaranteed to return a non-null array
00102         Object[] listeners = listenerList.getListenerList();
00103         // Process the listeners last to first, notifying
00104         // those that are interested in this event
00105         for (int i = listeners.length-2; i>=0; i-=2) {
00106             if (listeners[i]==CellEditorListener.class) {
00107                 ((CellEditorListener)listeners[i+1]).editingCanceled(new ChangeEvent(this));
00108             }          
00109         }
00110     }
00111 }
00112 

Generated on Thu Jul 15 09:55:38 2004 for SCT DAQ/DCS Software - Java by doxygen 1.3.5