Source Code Cross Referenced for CellEditor.java in  » 6.0-JDK-Core » swing » javax » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.swing;
027
028        import java.util.EventObject;
029        import javax.swing.event.*;
030
031        /**
032         * This interface defines the methods any general editor should be able
033         * to implement. <p>
034         *
035         * Having this interface enables complex components (the client of the
036         * editor) such as <code>JTree</code> and
037         * <code>JTable</code> to allow any generic editor to
038         * edit values in a table cell, or tree cell, etc.  Without this generic
039         * editor interface, <code>JTable</code> would have to know about specific editors,
040         * such as <code>JTextField</code>, <code>JCheckBox</code>, <code>JComboBox</code>,
041         * etc.  In addition, without this interface, clients of editors such as
042         * <code>JTable</code> would not be able
043         * to work with any editors developed in the future by the user
044         * or a 3rd party ISV. <p>
045         *
046         * To use this interface, a developer creating a new editor can have the
047         * new component implement the interface.  Or the developer can
048         * choose a wrapper based approach and provide a companion object which
049         * implements the <code>CellEditor</code> interface (See
050         * <code>JCellEditor</code> for example).  The wrapper approach
051         * is particularly useful if the user want to use a 3rd party ISV 
052         * editor with <code>JTable</code>, but the ISV didn't implement the
053         * <code>CellEditor</code> interface.  The user can simply create an object 
054         * that contains an instance of the 3rd party editor object and "translate"
055         * the <code>CellEditor</code> API into the 3rd party editor's API.
056         *
057         * @see javax.swing.event.CellEditorListener
058         *
059         * @version 1.32 05/05/07
060         * @author Alan Chung
061         */
062        public interface CellEditor {
063
064            /**
065             * Returns the value contained in the editor.
066             * @return the value contained in the editor
067             */
068            public Object getCellEditorValue();
069
070            /**
071             * Asks the editor if it can start editing using <code>anEvent</code>.
072             * <code>anEvent</code> is in the invoking component coordinate system.
073             * The editor can not assume the Component returned by
074             * <code>getCellEditorComponent</code> is installed.  This method
075             * is intended for the use of client to avoid the cost of setting up
076             * and installing the editor component if editing is not possible.
077             * If editing can be started this method returns true.
078             * 
079             * @param	anEvent		the event the editor should use to consider
080             *				whether to begin editing or not
081             * @return	true if editing can be started
082             * @see #shouldSelectCell
083             */
084            public boolean isCellEditable(EventObject anEvent);
085
086            /**
087             * Returns true if the editing cell should be selected, false otherwise.
088             * Typically, the return value is true, because is most cases the editing
089             * cell should be selected.  However, it is useful to return false to
090             * keep the selection from changing for some types of edits.
091             * eg. A table that contains a column of check boxes, the user might
092             * want to be able to change those checkboxes without altering the
093             * selection.  (See Netscape Communicator for just such an example) 
094             * Of course, it is up to the client of the editor to use the return
095             * value, but it doesn't need to if it doesn't want to.
096             *
097             * @param	anEvent		the event the editor should use to start
098             *				editing
099             * @return	true if the editor would like the editing cell to be selected;
100             *    otherwise returns false
101             * @see #isCellEditable
102             */
103            public boolean shouldSelectCell(EventObject anEvent);
104
105            /**
106             * Tells the editor to stop editing and accept any partially edited
107             * value as the value of the editor.  The editor returns false if
108             * editing was not stopped; this is useful for editors that validate
109             * and can not accept invalid entries.
110             *
111             * @return	true if editing was stopped; false otherwise
112             */
113            public boolean stopCellEditing();
114
115            /**
116             * Tells the editor to cancel editing and not accept any partially
117             * edited value.
118             */
119            public void cancelCellEditing();
120
121            /**
122             * Adds a listener to the list that's notified when the editor 
123             * stops, or cancels editing.
124             *
125             * @param	l		the CellEditorListener
126             */
127            public void addCellEditorListener(CellEditorListener l);
128
129            /**
130             * Removes a listener from the list that's notified
131             *
132             * @param	l		the CellEditorListener
133             */
134            public void removeCellEditorListener(CellEditorListener l);
135        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.