Source Code Cross Referenced for FolderChooser.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:         * @(#)FolderChooser.java 10/9/2005
003:         *
004:         * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
005:         */
006:        package com.jidesoft.swing;
007:
008:        import com.jidesoft.plaf.LookAndFeelFactory;
009:        import com.jidesoft.plaf.UIDefaultsLookup;
010:
011:        import javax.swing.*;
012:        import javax.swing.filechooser.FileSystemView;
013:        import java.io.File;
014:        import java.util.List;
015:
016:        /**
017:         * <code>FolderChooser</code> provides a simple mechanism for the user to
018:         * choose a folder.
019:         * <p/>
020:         * In addition to supporting the basic folder choosing function, it also supports create new folder, delete an existing
021:         * folder. Another useful feature is recent list. It allows you to set a list of recent selected folders so that user
022:         * can choose them directly inatead of navigating to it in the file system tree.
023:         * <p/>
024:         * The following code pops up a folder chooser for user to choose a folder.
025:         * <pre>
026:         *    FolderChooser chooser = new FolderChooser();
027:         *    int returnVal = chooser.showOpenDialog(parent);
028:         *    if(returnVal == FolderChooser.APPROVE_OPTION) {
029:         *       System.out.println("You chose to open this file: " +
030:         *            chooser.getSelectedFile().getName());
031:         *    }
032:         * </pre>
033:         */
034:        public class FolderChooser extends JFileChooser {
035:
036:            private static final String uiClassID = "FolderChooserUI";
037:
038:            private List<String> _recentList;
039:
040:            public final static String PROPERTY_RECENTLIST = "recentList";
041:
042:            public FolderChooser() {
043:            }
044:
045:            public FolderChooser(String currentDirectoryPath) {
046:                super (currentDirectoryPath);
047:            }
048:
049:            public FolderChooser(File currentDirectory) {
050:                super (currentDirectory);
051:            }
052:
053:            public FolderChooser(FileSystemView fsv) {
054:                super (fsv);
055:            }
056:
057:            public FolderChooser(File currentDirectory, FileSystemView fsv) {
058:                super (currentDirectory, fsv);
059:            }
060:
061:            public FolderChooser(String currentDirectoryPath, FileSystemView fsv) {
062:                super (currentDirectoryPath, fsv);
063:            }
064:
065:            /**
066:             * Gets recent selected folder list. The element in the list is {@link File}.
067:             *
068:             * @return the recent selected folder list.
069:             */
070:            public List<String> getRecentList() {
071:                return _recentList;
072:            }
073:
074:            /**
075:             * Sets the recent folder list. The element in the list should be {@link File}.
076:             * Property change event on {@link FolderChooser#PROPERTY_RECENTLIST} will be fired when recent folder list is changed.
077:             *
078:             * @param recentList the recent folder list.
079:             */
080:            public void setRecentList(List<String> recentList) {
081:                List<String> old = _recentList;
082:                _recentList = recentList;
083:                firePropertyChange(PROPERTY_RECENTLIST, old, recentList);
084:            }
085:
086:            /**
087:             * Resets the UI property to a value from the current look and
088:             * feel.
089:             *
090:             * @see JComponent#updateUI
091:             */
092:            @Override
093:            public void updateUI() {
094:                if (UIDefaultsLookup.get(uiClassID) == null) {
095:                    LookAndFeelFactory.installJideExtension();
096:                }
097:                setUI(UIManager.getUI(this ));
098:            }
099:
100:            /**
101:             * Returns a string that specifies the name of the L&F class
102:             * that renders this component.
103:             *
104:             * @return the string "FolderChooserUI"
105:             * @see JComponent#getUIClassID
106:             * @see UIDefaults#getUI
107:             */
108:            @Override
109:            public String getUIClassID() {
110:                return uiClassID;
111:            }
112:
113:            // we have to remove these two overridden method because it causes problem in
114:            // JFileChooser's setSelectedFile method where setCurrentDirectory
115:            // is called with selected file's parent folder.
116:
117:            //    /**
118:            //     * Current directory concept doesn't make sense in the case of FolderChooser. So we
119:            //     * override this method of JFileChooser and delegate to {@link #setSelectedFile(java.io.File)}.
120:            //     *
121:            //     * @param dir
122:            //     */
123:            //    public void setCurrentDirectory(File dir) {
124:            //        super.setSelectedFile(dir);
125:            //    }
126:            //
127:            //    /**
128:            //     * Current directory concept doesn't make sense in the case of FolderChooser. So we
129:            //     * override this method of JFileChooser and delegate to {@link #getSelectedFile()}.
130:            //     *
131:            //     * @return the selected folder.
132:            //     */
133:            //    public File getCurrentDirectory() {
134:            //        return super.getSelectedFile();
135:            //    }
136:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.