PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/net/sourceforge/jarbundler/DocumentType.java

#
Java | 188 lines | 58 code | 32 blank | 98 comment | 3 complexity | 0a866d888c9da9b5c18b460e86fa600e MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. package net.sourceforge.jarbundler;
  2. import java.lang.String;
  3. import java.io.File;
  4. import java.util.List;
  5. import java.util.Arrays;
  6. import java.util.ArrayList;
  7. /**
  8. * Represents an Info.plist DocumentType used for associating a document with
  9. * the application
  10. *
  11. * The Document Types allows you to specify which documents your finished
  12. * product can handle. You should list the application's primary document type
  13. * first because the document controller uses that type by default when the user
  14. * requests a new document.
  15. *
  16. * Name - The name of the document type.
  17. *
  18. *
  19. * Extensions - A list of the filename extensions for this document type. Don't
  20. * include the period in the extension.
  21. *
  22. *
  23. * OS Types - A list of four-letter codes for the document. These codes are
  24. * stored in the document's resources or information property list files.
  25. *
  26. *
  27. * MIME Types - A list of the Multipurpose Internet Mail Extensions (MIME) types
  28. * for the document. MIME types identify content types for Internet
  29. * applications.
  30. *
  31. *
  32. * Icon File - The name of the file that contains the document type's icon.
  33. *
  34. *
  35. * Role - A description of how the application uses the documents of this type.
  36. *
  37. * Editor - The application can display, edit, and save documents of this type.
  38. *
  39. * Viewer - The application can display, but not edit, documents of this type.
  40. *
  41. * Shell - The application provides runtime services for other processes for
  42. * example, a Java applet viewer.
  43. *
  44. * None - The application can neither display nor edit documents of this type
  45. * but instead uses them in some other way. For example, Sketch uses this role
  46. * to declare types it can export but not read.
  47. *
  48. *
  49. * Bundle - Specifies whether the document is a single file or a file bundle,
  50. * that is, a directory that is treated as a single document by certain
  51. * applications, such as the Finder.
  52. *
  53. *
  54. * <documenttype> name="Scan Project" extensions="scansort scanproj"
  55. * ostypes="fold disk fdrp" iconfile="document.icns" mimetypes="text/html
  56. * image/jpeg" role="editor" bundle="true" />
  57. *
  58. */
  59. public class DocumentType {
  60. private static final List EMPTYLIST = new ArrayList(0);
  61. /** Name. The name of the document type. */
  62. public String name = null;
  63. /**
  64. * Extensions. A list of the filename extensions for this document type.
  65. * Don't include the period in the extension.
  66. */
  67. public String[] extensions = null;
  68. /**
  69. * OS Types. A list of four-letter codes for the document. These codes are
  70. * stored in the document's resources or information property list files.
  71. */
  72. public String[] osTypes = null;
  73. /**
  74. * MIME Types. A list of the Multipurpose Internet Mail Extensions (MIME)
  75. * types for the document. MIME types identify content types for Internet
  76. * applications.
  77. */
  78. public String[] mimeTypes = null;
  79. /**
  80. * Icon File. The name of the file that contains the document types icon.
  81. */
  82. public File iconFile = null;
  83. /**
  84. * Role. A description of how the application uses the documents of this
  85. * type. You can choose from four values:
  86. * <p>
  87. * Editor. The application can display, edit, and save documents of this
  88. * type.
  89. * <p>
  90. * Viewer. The application can display, but not edit, documents of this
  91. * type.
  92. * <p>
  93. * Shell. The application provides runtime services for other processesfor
  94. * example, a Java applet viewer.
  95. * <p>
  96. * None. The application can neither display nor edit documents of this type
  97. * but instead uses them in some other way. For example, Sketch uses this
  98. * role to declare types it can export but not read.
  99. */
  100. public String role = null;
  101. /**
  102. * Bundle. Specifies whether the document is a single file document or a
  103. * document bundle, that is, a directory that is treated as a single
  104. * document by certain applications, such as the Finder.
  105. */
  106. public boolean isBundle = false;
  107. // Document type name
  108. public void setName(String name) {
  109. this.name = name;
  110. }
  111. public String getName() {
  112. return name;
  113. }
  114. // Extensions
  115. public void setExtensions(String extensions) {
  116. this.extensions = extensions.split("[\\s,]");
  117. }
  118. public List getExtensions() {
  119. return (extensions == null) ? EMPTYLIST : Arrays.asList(extensions);
  120. }
  121. // OS Types
  122. public void setOSTypes(String osTypes) {
  123. this.osTypes = osTypes.split("[\\s,]");
  124. }
  125. public List getOSTypes() {
  126. return (osTypes == null) ? EMPTYLIST : Arrays.asList(osTypes);
  127. }
  128. // mime-types
  129. public void setMimeTypes(String mimeTypes) {
  130. this.mimeTypes = mimeTypes.split("[\\s,]");
  131. }
  132. public List getMimeTypes() {
  133. return (mimeTypes == null) ? EMPTYLIST : Arrays.asList(this.mimeTypes);
  134. }
  135. // Document icon file
  136. public void setIconFile(File iconFile) {
  137. this.iconFile = iconFile;
  138. }
  139. public File getIconFile() {
  140. return iconFile;
  141. }
  142. // Document role
  143. public void setRole(String role) {
  144. this.role = role;
  145. }
  146. public String getRole() {
  147. return role;
  148. }
  149. // Is this document represented as a bundle
  150. public void setBundle(boolean isBundle) {
  151. this.isBundle = isBundle;
  152. }
  153. public boolean isBundle() {
  154. return isBundle;
  155. }
  156. }