001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.localversioningfilesystem;
020:
021: import javax.swing.Icon;
022:
023: import org.openharmonise.commons.xml.namespace.NamespaceType;
024: import org.openharmonise.vfs.*;
025: import org.openharmonise.vfs.gui.*;
026: import org.openharmonise.vfs.metadata.*;
027:
028: /**
029: * @author Matthew Large
030: * @version $Revision: 1.2 $
031: *
032: */
033: public class LocalVersioningFileSystemView implements
034: VirtualFileSystemView {
035:
036: /**
037: *
038: */
039: public LocalVersioningFileSystemView() {
040: super ();
041: }
042:
043: /* (non-Javadoc)
044: * @see com.simulacramedia.vfs.VirtualFileView#getIcon(com.simulacramedia.vfs.VirtualFile)
045: */
046: public Icon getIcon(VirtualFile vfFile) {
047: if (vfFile.isDirectory()) {
048: if (vfFile.getFullPath().startsWith(
049: "/webdav/Metadata/Properties")) {
050: return IconManager.getInstance().getIcon(
051: "16-property-container.gif");
052: } else if (vfFile.getFullPath().startsWith(
053: "/webdav/Metadata/Values")) {
054: return IconManager.getInstance().getIcon(
055: "16-value-container.gif");
056: } else if (vfFile.getFullPath().startsWith(
057: "/webdav/Reports")) {
058: return IconManager.getInstance().getIcon(
059: "16-report-folder.gif");
060: } else if (vfFile.getFullPath().startsWith(
061: "/webdav/Templates")) {
062: return IconManager.getInstance().getIcon(
063: "16-folder.gif");
064: } else if (vfFile.getFullPath().startsWith(
065: "/webdav/Newsletter/draft")) {
066: return IconManager.getInstance().getIcon(
067: "16-newsletter-draft.gif");
068: } else if (vfFile.getFullPath().startsWith(
069: "/webdav/Newsletter/sent")) {
070: return IconManager.getInstance().getIcon(
071: "16-newsletter-sent.gif");
072: } else if (vfFile.getFullPath().startsWith(
073: "/webdav/Newsletter/outbox")) {
074: return IconManager.getInstance().getIcon(
075: "16-newsletter-outbox.gif");
076: } else if (vfFile.getFullPath().startsWith("/webdav/Users")) {
077: return IconManager.getInstance().getIcon(
078: "16-user-container.gif");
079: } else {
080: return IconManager.getInstance().getIcon(
081: "16-section.gif");
082: }
083: } else {
084: if (vfFile.getFullPath().startsWith("/webdav/Users")) {
085: return IconManager.getInstance().getIcon("16-user.gif");
086: } else if (vfFile.getFullPath().startsWith(
087: "/webdav/Assets/Flash")) {
088: return IconManager.getInstance()
089: .getIcon("16-movie.gif");
090: } else if (vfFile.getFullPath().startsWith(
091: "/webdav/Assets/Link")) {
092: return IconManager.getInstance().getIcon("16-link.gif");
093: } else if (vfFile.getFullPath().startsWith(
094: "/webdav/Assets/Web Resources")) {
095: return IconManager.getInstance().getIcon("16-link.gif");
096: } else if (vfFile.getFullPath().startsWith(
097: "/webdav/Assets/Email")) {
098: return IconManager.getInstance()
099: .getIcon("16-email.gif");
100: } else if (vfFile.getFullPath().startsWith(
101: "/webdav/Assets/Image")) {
102: return IconManager.getInstance()
103: .getIcon("16-image.gif");
104: } else if (vfFile.getFullPath().startsWith(
105: "/webdav/Metadata/Properties")) {
106: return IconManager.getInstance().getIcon(
107: "16-property.gif");
108: } else if (vfFile.getFullPath().startsWith(
109: "/webdav/Metadata/Values")) {
110: return IconManager.getInstance()
111: .getIcon("16-value.gif");
112: } else if (vfFile.getFullPath().startsWith(
113: "/webdav/Newsletter")) {
114: return IconManager.getInstance().getIcon(
115: "16-newsletter.gif");
116: } else if (vfFile.getFullPath().startsWith(
117: "/webdav/Reports")) {
118: return IconManager.getInstance().getIcon(
119: "16-report.gif");
120: } else if (vfFile.getFullPath().startsWith(
121: "/webdav/Templates")) {
122: return IconManager.getInstance().getIcon(
123: "16-template.gif");
124: } else {
125: return IconManager.getInstance().getIcon(
126: "16-document.gif");
127: }
128: }
129: }
130:
131: /* (non-Javadoc)
132: * @see com.simulacramedia.vfs.VirtualFileView#getIcon(com.simulacramedia.vfs.VirtualFile, boolean)
133: */
134: public Icon getIcon(VirtualFile vfFile, boolean bIsDirectoryOpen) {
135: if (vfFile.getFullPath().startsWith(
136: "/webdav/Metadata/Properties")) {
137: return IconManager.getInstance().getIcon(
138: "16-property-container.gif");
139: } else if (vfFile.getFullPath().startsWith(
140: "/webdav/Metadata/Values")) {
141: return IconManager.getInstance().getIcon(
142: "16-value-container.gif");
143: } else if (vfFile.getFullPath().startsWith("/webdav/Templates")) {
144: if (bIsDirectoryOpen) {
145: return IconManager.getInstance().getIcon(
146: "16-folder-open.gif");
147: } else {
148: return IconManager.getInstance().getIcon(
149: "16-folder.gif");
150: }
151: } else if (vfFile.getFullPath().startsWith("/webdav/Reports")) {
152: if (bIsDirectoryOpen) {
153: return IconManager.getInstance().getIcon(
154: "16-report-folder-open.gif");
155: } else {
156: return IconManager.getInstance().getIcon(
157: "16-report-folder.gif");
158: }
159: } else if (vfFile.getFullPath().startsWith(
160: "/webdav/Newsletter/draft")) {
161: return IconManager.getInstance().getIcon(
162: "16-newsletter-draft.gif");
163: } else if (vfFile.getFullPath().startsWith(
164: "/webdav/Newsletter/sent")) {
165: return IconManager.getInstance().getIcon(
166: "16-newsletter-sent.gif");
167: } else if (vfFile.getFullPath().startsWith(
168: "/webdav/Newsletter/outbox")) {
169: return IconManager.getInstance().getIcon(
170: "16-newsletter-outbox.gif");
171: } else if (vfFile.getFullPath().startsWith("/webdav/Users")) {
172: return IconManager.getInstance().getIcon(
173: "16-user-container.gif");
174: } else if (bIsDirectoryOpen) {
175: return IconManager.getInstance().getIcon(
176: "16-section-open.gif");
177: } else {
178: return IconManager.getInstance().getIcon("16-section.gif");
179: }
180: }
181:
182: /* (non-Javadoc)
183: * @see com.simulacramedia.vfs.VirtualFileView#getDisplayName(com.simulacramedia.vfs.VirtualFile)
184: */
185: public String getDisplayName(VirtualFile vfFile) {
186: return vfFile.getFileName();
187: }
188:
189: /* (non-Javadoc)
190: * @see com.simulacramedia.vfs.VirtualFileSystemView#getFileSystemIcon()
191: */
192: public Icon getFileSystemIcon() {
193: return null;
194: }
195:
196: /* (non-Javadoc)
197: * @see com.simulacramedia.vfs.VirtualFileSystemView#getFileSystemDisplayName()
198: */
199: public String getFileSystemDisplayName() {
200: return null;
201: }
202:
203: /* (non-Javadoc)
204: * @see com.simulacramedia.vfs.VirtualFileSystemView#getVFSIndependantProperty(java.lang.String)
205: */
206: public PropertyInstance getVFSIndependantProperty(
207: String sIndependantPropName) {
208: return null;
209: }
210:
211: /* (non-Javadoc)
212: * @see com.simulacramedia.vfs.VirtualFileSystemView#getModificationDate()
213: */
214: public String getModificationDate(VirtualFile vfFile) {
215: PropertyInstance propInst = vfFile.getProperty(
216: NamespaceType.OHRM.getURI(), "datemodified");
217: if (propInst != null && propInst.getValues().size() > 0) {
218: return (String) propInst.getValues().get(0);
219: } else {
220: return "none";
221: }
222: }
223:
224: /* (non-Javadoc)
225: * @see com.simulacramedia.vfs.VirtualFileSystemView#getContentType(com.simulacramedia.vfs.VirtualFile)
226: */
227: public String getContentType(VirtualFile vfFile) {
228: return "text/xml";
229: }
230:
231: /* (non-Javadoc)
232: * @see com.simulacramedia.vfs.VirtualFileSystemView#setContentType(com.simulacramedia.vfs.VirtualFile, java.lang.String)
233: */
234: public void setContentType(VirtualFile vfFile, String sContentType) {
235: }
236:
237: /* (non-Javadoc)
238: * @see com.simulacramedia.vfs.VirtualFileSystemView#getSummary(com.simulacramedia.vfs.VirtualFile)
239: */
240: public String getSummary(VirtualFile vfFile) {
241: return null;
242: }
243:
244: /* (non-Javadoc)
245: * @see com.simulacramedia.vfs.VirtualFileSystemView#getLogicalFileName(com.simulacramedia.vfs.VirtualFile)
246: */
247: public String getLogicalFileName(VirtualFile vfFile) {
248: return null;
249: }
250:
251: /* (non-Javadoc)
252: * @see com.simulacramedia.vfs.VirtualFileSystemView#getPublicationDate(com.simulacramedia.vfs.VirtualFile)
253: */
254: public String getPublicationDate(VirtualFile vfFile) {
255: return "none";
256: }
257:
258: /* (non-Javadoc)
259: * @see com.simulacramedia.vfs.VirtualFileSystemView#getArchiveDate(com.simulacramedia.vfs.VirtualFile)
260: */
261: public String getArchiveDate(VirtualFile vfFile) {
262: return "none";
263: }
264:
265: }
|