Source Code Cross Referenced for SearchableEvent.java in  » Swing-Library » jide-common » com » jidesoft » swing » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jide common » com.jidesoft.swing.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)SearchableEvent.java
003:         *
004:         * Copyright 2002 - 2004 JIDE Software Inc. All rights reserved.
005:         */
006:        package com.jidesoft.swing.event;
007:
008:        import com.jidesoft.swing.Searchable;
009:
010:        import java.awt.*;
011:
012:        /**
013:         * An <code>AWTEvent</code> that adds support for
014:         * <code>SearchableEvent</code> objects as the event source.
015:         *
016:         * @see com.jidesoft.swing.Searchable
017:         * @see SearchableListener
018:         */
019:        public class SearchableEvent extends AWTEvent {
020:
021:            private String _searchingText;
022:            private String _oldSearchingText;
023:            private String _matchingText;
024:            private Object _matchingObject;
025:
026:            /**
027:             * Creates a <code>SearchableEvent</code>.
028:             *
029:             * @param source
030:             * @param id
031:             */
032:            public SearchableEvent(Searchable source, int id) {
033:                super (source, id);
034:            }
035:
036:            /**
037:             * Creates a <code>SearchableEvent</code>. The searching text is the text that is being searched for.
038:             *
039:             * @param source
040:             * @param id
041:             * @param searchingText
042:             */
043:            public SearchableEvent(Object source, int id, String searchingText) {
044:                super (source, id);
045:                _searchingText = searchingText;
046:            }
047:
048:            public SearchableEvent(Object source, int id, String searchingText,
049:                    String oldSearchingText) {
050:                super (source, id);
051:                _searchingText = searchingText;
052:                _oldSearchingText = oldSearchingText;
053:            }
054:
055:            public SearchableEvent(Object source, int id, String searchingText,
056:                    Object matchingObject, String matchingText) {
057:                super (source, id);
058:                _searchingText = searchingText;
059:                _matchingObject = matchingObject;
060:                _matchingText = matchingText;
061:            }
062:
063:            /**
064:             * The first number in the range of IDs used for <code>SearchableEvent</code>.
065:             */
066:            public static final int SEARCHABLE_FIRST = AWTEvent.RESERVED_ID_MAX + 1000;
067:
068:            /**
069:             * The last number in the range of IDs used for <code>SearchableEvent</code>.
070:             */
071:            public static final int SEARCHABLE_LAST = SEARCHABLE_FIRST + 6;
072:
073:            /**
074:             * To indicate the searching process started. It is fired when the search popup shows up.
075:             */
076:            public static final int SEARCHABLE_START = SEARCHABLE_FIRST;
077:
078:            /**
079:             * To indicate the searching process stopped. It is fired when the search popup is gone.
080:             */
081:            public static final int SEARCHABLE_END = SEARCHABLE_FIRST + 1;
082:
083:            /**
084:             * To indicate the searching process finds a matching element. In this case, <code>getSearchingText()</code> will return
085:             * the text that is being searched for. <code>getMatchingObject()</code> will return the element that matches the searching text.
086:             * <code>getMatchingText()</code> is the text converting from the the matching object.
087:             */
088:            public static final int SEARCHABLE_MATCH = SEARCHABLE_FIRST + 3;
089:
090:            /**
091:             * To indicate the searching process doesn't find a matching element. In this case, <code>getSearchingText()</code> will return
092:             * the text that is being searched for. <code>getMatchingObject()</code> and <code>getMatchingText()</code> will be null.
093:             */
094:            public static final int SEARCHABLE_NOMATCH = SEARCHABLE_FIRST + 4;
095:
096:            /**
097:             * To indicate the searching text changes. In this case, <code>getSearchingText()</code> will return
098:             * the text that is being searched for. <code>getOldSearchingText()</code> will return the previous searching text.
099:             */
100:            public static final int SEARCHABLE_CHANGE = SEARCHABLE_FIRST + 5;
101:
102:            /**
103:             * To indicate the search component model is changed. The model could be ListModel in the case of JList, TableModel in the case
104:             * of JTable, etc.
105:             */
106:            public static final int SEARCHABLE_MODEL_CHANGE = SEARCHABLE_FIRST + 6;
107:
108:            /**
109:             * Returns a parameter string identifying this event.
110:             * This method is useful for event logging and for debugging.
111:             *
112:             * @return a string identifying the event and its attributes
113:             */
114:            @Override
115:            public String paramString() {
116:                String typeStr;
117:                switch (id) {
118:                case SEARCHABLE_START:
119:                    typeStr = "SEARCHABLE_START: searchingText = \""
120:                            + _searchingText + "\"";
121:                    break;
122:                case SEARCHABLE_END:
123:                    typeStr = "SEARCHABLE_END";
124:                    break;
125:                case SEARCHABLE_MATCH:
126:                    typeStr = "SEARCHABLE_MATCH: searchingText = \""
127:                            + _searchingText + "\" matchingText = \""
128:                            + _matchingText + "\"";
129:                    break;
130:                case SEARCHABLE_NOMATCH:
131:                    typeStr = "SEARCHABLE_NOMATCH: searchingText = \""
132:                            + _searchingText + "\"";
133:                    break;
134:                case SEARCHABLE_CHANGE:
135:                    typeStr = "SEARCHABLE_CHANGE: searchingText = \""
136:                            + _searchingText + "\" oldSearchingText = \""
137:                            + _oldSearchingText + "\"";
138:                    break;
139:                case SEARCHABLE_MODEL_CHANGE:
140:                    typeStr = "SEARCHABLE_MODEL";
141:                    break;
142:                default:
143:                    typeStr = "SEARCHABLE_UNKNOWN";
144:                }
145:                return typeStr;
146:            }
147:
148:            /**
149:             * Returns the originator of the event.
150:             *
151:             * @return the <code>Searchable</code> object that originated the event
152:             */
153:
154:            public Searchable getSearchable() {
155:                return (source instanceof  Searchable) ? (Searchable) source
156:                        : null;
157:            }
158:
159:            /**
160:             * Gets the text that is being searched for. The returned value is valid for events SEARCHABLE_START,
161:             * SEARCHABLE_MATCH, SEARCHABLE_NOMATCH, and SEARCHABLE_CHANGE.
162:             *
163:             * @return the text that is being searched for.
164:             */
165:            public String getSearchingText() {
166:                return _searchingText;
167:            }
168:
169:            /**
170:             * Gets the text that was searched for.
171:             * The returned value is only valid for event SEARCHABLE_CHANGE.
172:             *
173:             * @return the text that was searched for.
174:             */
175:            public String getOldSearchingText() {
176:                return _oldSearchingText;
177:            }
178:
179:            /**
180:             * Gets the text that is converted from the object matching the searching text.
181:             * The returned value is only valid for events SEARCHABLE_MATCH.
182:             *
183:             * @return the text that is converted from the object matching the searching text.
184:             */
185:            public String getMatchingText() {
186:                return _matchingText;
187:            }
188:
189:            /**
190:             * Gets the object that matches the searching text.
191:             * The returned value is only valid for events SEARCHABLE_MATCH.
192:             *
193:             * @return Gets the object that matches the searching text.
194:             */
195:            public Object getMatchingObject() {
196:                return _matchingObject;
197:            }
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.