Source Code Cross Referenced for FileOp.java in  » UML » umlet » com » umlet » control » io » 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 » UML » umlet » com.umlet.control.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The UMLet source code is distributed under the terms of the GPL; see license.txt
002:        package com.umlet.control.io;
003:
004:        import java.io.*;
005:
006:        import javax.swing.*;
007:        import javax.swing.filechooser.FileFilter;
008:
009:        import com.umlet.control.*;
010:
011:        public class FileOp {
012:            public static JFileChooser jfcOpenMlt;
013:            public static JFileChooser jfcSaveAsMlt;
014:            public static JFileChooser jfcSaveAsSvg;
015:            public static JFileChooser jfcSaveAsPdf;
016:            public static JFileChooser jfcSaveAsJpg;
017:            public static JFileChooser jfcSaveAsEPS; //LME
018:
019:            private String saveFileName = null;
020:
021:            public static FileOp _instance;
022:
023:            public static FileOp getInstance() {
024:                if (_instance == null) {
025:                    _instance = new FileOp();
026:                }
027:                return _instance;
028:            }
029:
030:            private FileOp() { //LME 22.7. content moved to respective methods (JFileChooser problem)
031:            }
032:
033:            public String getJpgFilename() {
034:                if (jfcSaveAsJpg == null) {
035:                    jfcSaveAsJpg = new JFileChooser(System
036:                            .getProperty("user.dir"));
037:                    FileFilter filter = new FileFilter() {
038:                        public boolean accept(File f) {
039:                            return (f.getName().endsWith(".jpg")
040:                                    || f.getName().endsWith(".jpeg") || f
041:                                    .isDirectory());
042:                        }
043:
044:                        public String getDescription() {
045:                            return "JPG format (*.jpg, *.jpeg)";
046:                        }
047:                    };
048:                    jfcSaveAsJpg.setFileFilter(filter);
049:                    jfcSaveAsJpg.setSelectedFile(new File(".jpg"));
050:                }
051:                int returnVal = jfcSaveAsJpg
052:                        .showSaveDialog(Umlet.getInstance());
053:                if (returnVal != JFileChooser.APPROVE_OPTION)
054:                    return null;
055:                return jfcSaveAsJpg.getSelectedFile().getAbsolutePath();
056:            }
057:
058:            public String getSvgFilename() {
059:                if (jfcSaveAsSvg == null) {
060:                    jfcSaveAsSvg = new JFileChooser(System
061:                            .getProperty("user.dir"));
062:                    FileFilter filter = new FileFilter() {
063:                        public boolean accept(File f) {
064:                            return (f.getName().endsWith(".svg") || f
065:                                    .isDirectory());
066:                        }
067:
068:                        public String getDescription() {
069:                            return "SVG format (*.svg)";
070:                        }
071:                    };
072:                    jfcSaveAsSvg.setFileFilter(filter);
073:                    jfcSaveAsSvg.setSelectedFile(new File(".svg"));
074:                }
075:                int returnVal = jfcSaveAsSvg
076:                        .showSaveDialog(Umlet.getInstance());
077:                if (returnVal != JFileChooser.APPROVE_OPTION)
078:                    return null;
079:                return jfcSaveAsSvg.getSelectedFile().getAbsolutePath();
080:            }
081:
082:            public String getPdfFilename() {
083:                if (jfcSaveAsPdf == null) {
084:                    jfcSaveAsPdf = new JFileChooser(System
085:                            .getProperty("user.dir"));
086:                    FileFilter filter = new FileFilter() {
087:                        public boolean accept(File f) {
088:                            return (f.getName().endsWith(".pdf") || f
089:                                    .isDirectory());
090:                        }
091:
092:                        public String getDescription() {
093:                            return "PDF format (*.pdf)";
094:                        }
095:                    };
096:                    jfcSaveAsPdf.setFileFilter(filter);
097:                    jfcSaveAsPdf.setSelectedFile(new File(".pdf"));
098:                }
099:                int returnVal = jfcSaveAsPdf
100:                        .showSaveDialog(Umlet.getInstance());
101:                if (returnVal != JFileChooser.APPROVE_OPTION)
102:                    return null;
103:                return jfcSaveAsPdf.getSelectedFile().getAbsolutePath();
104:            }
105:
106:            public String getEpsFilename() { //LME
107:                if (jfcSaveAsEPS == null) {
108:                    jfcSaveAsEPS = new JFileChooser(System
109:                            .getProperty("user.dir")); //LME
110:                    FileFilter filter = new FileFilter() {
111:                        public boolean accept(File f) {
112:                            return (f.getName().endsWith(".eps") || f
113:                                    .isDirectory());
114:                        }
115:
116:                        public String getDescription() {
117:                            return "EPS format (*.eps)";
118:                        }
119:                    };
120:                    jfcSaveAsEPS.setFileFilter(filter);
121:                    jfcSaveAsEPS.setSelectedFile(new File(".eps"));
122:                }
123:                int returnVal = jfcSaveAsEPS
124:                        .showSaveDialog(Umlet.getInstance());
125:                if (returnVal != JFileChooser.APPROVE_OPTION)
126:                    return null;
127:                return jfcSaveAsEPS.getSelectedFile().getAbsolutePath();
128:            }
129:
130:            public String getMltSaveFilename(boolean ask_again) {
131:                if (jfcSaveAsMlt == null) {
132:                    jfcSaveAsMlt = new JFileChooser(System
133:                            .getProperty("user.dir"));
134:                    FileFilter filter = new FileFilter() {
135:                        public boolean accept(File f) {
136:                            return (f.getName().endsWith(".uxf") || f
137:                                    .isDirectory());
138:                        }
139:
140:                        public String getDescription() {
141:                            return "UMLet diagram format (*.uxf)";
142:                        }
143:                    };
144:                    jfcSaveAsMlt.setFileFilter(filter);
145:                    jfcSaveAsMlt.setSelectedFile(new File(".uxf"));
146:                }
147:                if (ask_again) {
148:                    int returnVal = jfcSaveAsMlt.showSaveDialog(Umlet
149:                            .getInstance());
150:                    if (returnVal != JFileChooser.APPROVE_OPTION)
151:                        return null;
152:                    saveFileName = jfcSaveAsMlt.getSelectedFile()
153:                            .getAbsolutePath();
154:                    setSaveMenuItem(true);
155:                }
156:                return saveFileName;
157:            }
158:
159:            public String getMltOpenFilename() {
160:                if (jfcOpenMlt == null) {
161:                    jfcOpenMlt = new JFileChooser(System
162:                            .getProperty("user.dir"));
163:                    FileFilter filter = new FileFilter() {
164:                        public boolean accept(File f) {
165:                            return (f.getName().endsWith(".uxf") || f
166:                                    .isDirectory());
167:                        }
168:
169:                        public String getDescription() {
170:                            return "UMLet diagram format (*.uxf)";
171:                        }
172:                    };
173:                    jfcOpenMlt.setFileFilter(filter);
174:                }
175:                String fileName = null;
176:                int returnVal = jfcOpenMlt.showOpenDialog(Umlet.getInstance());
177:                if (returnVal == JFileChooser.APPROVE_OPTION) {
178:                    fileName = jfcOpenMlt.getSelectedFile().getAbsolutePath();
179:                }
180:                if (fileName != null)
181:                    saveFileName = fileName;
182:                return fileName;
183:            }
184:
185:            public void setSaveMenuItem(boolean b) {
186:                if (Umlet.getInstance()._saveMenuItem != null) {
187:                    Umlet.getInstance()._saveMenuItem.setEnabled(b);
188:                }
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.