Source Code Cross Referenced for SearchableUtils.java in  » Swing-Library » jide-common » com » jidesoft » swing » 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 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)SearchableUtils.java
003:         *
004:         * Copyright 2002 - 2004 JIDE Software Inc. All rights reserved.
005:         */
006:        package com.jidesoft.swing;
007:
008:        import javax.swing.*;
009:        import javax.swing.text.JTextComponent;
010:
011:        /**
012:         * Utility class to make component searchable. It's very easy to use this class.
013:         * In order to make a component, all you need to do is to call
014:         * <code><pre>
015:         * SearchableUtils.installSearchable(component);
016:         * </pre></code>
017:         * The component could be a JList, JTree or JTable. If you need to further customize some
018:         * attributes of Searchable, you can assign a variable that returns from installSearchable().
019:         * <code><pre>
020:         * Searchable searchable = SearchableUtils.installSearchable(component);
021:         * // further configure it
022:         * searchable.setCaseSensitive(true);
023:         * // ...
024:         * </pre></code>
025:         * Usually you don't need to uninstall the searchable from the component. But if for some reason, you need
026:         * to disable the searchable feature of the component, you can call uninstallSearchable().
027:         * <code><pre>
028:         * Searchable searchable = SearchableUtils.installSearchable(component);
029:         * // ...
030:         * // Now disable it
031:         * SearchableUtils.uninstallSearchable(searchable);
032:         * </pre></code>
033:         * <p/>
034:         * There is a small trick that you should know. JTree and JList implemented partially the
035:         * quick search feature so that when you type in the first charactor, it will jump to the first
036:         * occurence. This feature sometimes conflicts with the Searchable we provided. So it'd better
037:         * if you disable the JTree or JList default feature by creating JTree
038:         * and JList with getNextMatch method overridden. See below
039:         * <code><pre>
040:         * JTree tree = new JTree(...) {
041:         *     public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias) {
042:         *         return null;
043:         *     }
044:         * };
045:         * <p/>
046:         * JList list = new JList(...){
047:         *     public int getNextMatch(String prefix, int startIndex, Position.Bias bias) {
048:         *         return -1;
049:         *     }
050:         * };
051:         * </pre></code>
052:         */
053:        public class SearchableUtils {
054:            /**
055:             * Installs the searchable function onto a JTree.
056:             *
057:             * @param tree
058:             * @return A TreeSearchable
059:             */
060:            public static TreeSearchable installSearchable(JTree tree) {
061:                return new TreeSearchable(tree);
062:            }
063:
064:            /**
065:             * Installs the searchable function onto a JTable.
066:             *
067:             * @param table
068:             * @return A TableSearchable
069:             */
070:            public static TableSearchable installSearchable(JTable table) {
071:                return new TableSearchable(table);
072:            }
073:
074:            /**
075:             * Installs the searchable function onto a JList.
076:             *
077:             * @param list
078:             * @return A ListSearchable
079:             */
080:            public static ListSearchable installSearchable(JList list) {
081:                return new ListSearchable(list);
082:            }
083:
084:            /**
085:             * Installs the searchable function onto a JComboBox.
086:             *
087:             * @param combobox
088:             * @return A ComboBoxSearchable
089:             */
090:            public static ComboBoxSearchable installSearchable(
091:                    JComboBox combobox) {
092:                return new ComboBoxSearchable(combobox);
093:            }
094:
095:            /**
096:             * Installs the searchable function onto a JTextComponent.
097:             *
098:             * @param textComponent
099:             * @return A TextComponentSearchable
100:             */
101:            public static TextComponentSearchable installSearchable(
102:                    JTextComponent textComponent) {
103:                return new TextComponentSearchable(textComponent);
104:            }
105:
106:            public static void uninstallSearchable(Searchable searchable) {
107:                searchable.uninstallListeners();
108:            }
109:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.