KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > jarbundler > DocumentType


1 package net.sourceforge.jarbundler;
2
3 import java.lang.String JavaDoc;
4
5 import java.io.File JavaDoc;
6
7 import java.util.List JavaDoc;
8 import java.util.Arrays JavaDoc;
9 import java.util.ArrayList JavaDoc;
10
11 /**
12  * Represents an Info.plist DocumentType used for associating a document with
13  * the application
14  *
15  * The Document Types allows you to specify which documents your finished
16  * product can handle. You should list the application's primary document type
17  * first because the document controller uses that type by default when the user
18  * requests a new document.
19  *
20  * Name - The name of the document type.
21  *
22  *
23  * Extensions - A list of the filename extensions for this document type. Don't
24  * include the period in the extension.
25  *
26  *
27  * OS Types - A list of four-letter codes for the document. These codes are
28  * stored in the document's resources or information property list files.
29  *
30  *
31  * MIME Types - A list of the Multipurpose Internet Mail Extensions (MIME) types
32  * for the document. MIME types identify content types for Internet
33  * applications.
34  *
35  *
36  * Icon File - The name of the file that contains the document type's icon.
37  *
38  *
39  * Role - A description of how the application uses the documents of this type.
40  *
41  * Editor - The application can display, edit, and save documents of this type.
42  *
43  * Viewer - The application can display, but not edit, documents of this type.
44  *
45  * Shell - The application provides runtime services for other processes for
46  * example, a Java applet viewer.
47  *
48  * None - The application can neither display nor edit documents of this type
49  * but instead uses them in some other way. For example, Sketch uses this role
50  * to declare types it can export but not read.
51  *
52  *
53  * Bundle - Specifies whether the document is a single file or a file bundle,
54  * that is, a directory that is treated as a single document by certain
55  * applications, such as the Finder.
56  *
57  *
58  * <documenttype> name="Scan Project" extensions="scansort scanproj"
59  * ostypes="fold disk fdrp" iconfile="document.icns" mimetypes="text/html
60  * image/jpeg" role="editor" bundle="true" />
61  *
62  */

63
64
65 public class DocumentType {
66
67     private static final List JavaDoc EMPTYLIST = new ArrayList JavaDoc(0);
68
69     /** Name. The name of the document type. */
70     public String JavaDoc name = null;
71
72     /**
73      * Extensions. A list of the filename extensions for this document type.
74      * Don't include the period in the extension.
75      */

76
77     public String JavaDoc[] extensions = null;
78     /**
79      * OS Types. A list of four-letter codes for the document. These codes are
80      * stored in the document's resources or information property list files.
81      */

82
83     public String JavaDoc[] osTypes = null;
84     /**
85      * MIME Types. A list of the Multipurpose Internet Mail Extensions (MIME)
86      * types for the document. MIME types identify content types for Internet
87      * applications.
88      */

89
90     public String JavaDoc[] mimeTypes = null;
91
92     /**
93      * Icon File. The name of the file that contains the document types icon.
94      */

95
96     public File JavaDoc iconFile = null;
97     /**
98      * Role. A description of how the application uses the documents of this
99      * type. You can choose from four values:
100      * <p>
101      * Editor. The application can display, edit, and save documents of this
102      * type.
103      * <p>
104      * Viewer. The application can display, but not edit, documents of this
105      * type.
106      * <p>
107      * Shell. The application provides runtime services for other processesfor
108      * example, a Java applet viewer.
109      * <p>
110      * None. The application can neither display nor edit documents of this type
111      * but instead uses them in some other way. For example, Sketch uses this
112      * role to declare types it can export but not read.
113      */

114
115     public String JavaDoc role = null;
116
117     /**
118      * Bundle. Specifies whether the document is a single file document or a
119      * document bundle, that is, a directory that is treated as a single
120      * document by certain applications, such as the Finder.
121      */

122
123     public boolean isBundle = false;
124
125     // Document type name
126
public void setName(String JavaDoc name) {
127         this.name = name;
128     }
129
130     public String JavaDoc getName() {
131         return name;
132     }
133
134     // Extensions
135
public void setExtensions(String JavaDoc extensions) {
136         this.extensions = extensions.split("[\\s,]");
137     }
138
139     public List JavaDoc getExtensions() {
140         return (extensions == null) ? EMPTYLIST : Arrays.asList(extensions);
141     }
142
143     // OS Types
144
public void setOSTypes(String JavaDoc osTypes) {
145         this.osTypes = osTypes.split("[\\s,]");
146     }
147
148     public List JavaDoc getOSTypes() {
149         return (osTypes == null) ? EMPTYLIST : Arrays.asList(osTypes);
150     }
151
152     // mime-types
153
public void setMimeTypes(String JavaDoc mimeTypes) {
154         this.mimeTypes = mimeTypes.split("[\\s,]");
155     }
156
157     public List JavaDoc getMimeTypes() {
158         return (mimeTypes == null) ? EMPTYLIST : Arrays.asList(this.mimeTypes);
159     }
160
161     // Document icon file
162
public void setIconFile(File JavaDoc iconFile) {
163         this.iconFile = iconFile;
164     }
165
166     public File JavaDoc getIconFile() {
167         return iconFile;
168     }
169
170     // Document role
171
public void setRole(String JavaDoc role) {
172         this.role = role;
173     }
174
175     public String JavaDoc getRole() {
176         return role;
177     }
178
179     // Is this document represented as a bundle
180
public void setBundle(boolean isBundle) {
181         this.isBundle = isBundle;
182     }
183
184     public boolean isBundle() {
185         return isBundle;
186     }
187
188 }
189
Popular Tags