Source Code Cross Referenced for WebDAVFileSystemView.java in  » Content-Management-System » harmonise » org » openharmonise » webdav » client » 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 » Content Management System » harmonise » org.openharmonise.webdav.client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.webdav.client;
020:
021:        import java.text.*;
022:
023:        import javax.swing.*;
024:
025:        import org.openharmonise.commons.xml.namespace.*;
026:        import org.openharmonise.him.harmonise.*;
027:        import org.openharmonise.vfs.*;
028:        import org.openharmonise.vfs.gui.*;
029:        import org.openharmonise.vfs.metadata.*;
030:        import org.openharmonise.vfs.metadata.value.*;
031:        import org.openharmonise.webdav.client.methods.*;
032:        import org.openharmonise.webdav.client.value.*;
033:        import org.openharmonise.webdav.date.*;
034:
035:        /**
036:         * WebDAV implementation of the VirtualFileSystemView.
037:         * 
038:         * @author Matthew Large
039:         * @version $Revision: 1.2 $
040:         *
041:         */
042:        public class WebDAVFileSystemView implements  VirtualFileSystemView {
043:
044:            private String DISPLAY_DATE_FORMAT = "yyyy-MM-dd HH:mm";
045:
046:            public WebDAVFileSystemView() {
047:                super ();
048:            }
049:
050:            /* (non-Javadoc)
051:             * @see com.simulacramedia.vfs.VirtualFileView#getIcon(com.simulacramedia.vfs.VirtualFile)
052:             */
053:            public Icon getIcon(VirtualFile vfFile) {
054:                if ((vfFile.getState() == VirtualFile.STATE_HISTORICAL || vfFile
055:                        .getState() == VirtualFile.STATE_PENDING)
056:                        && ((VersionedVirtualFile) vfFile).getLiveVersionPath() != null) {
057:                    vfFile = ((VersionedVirtualFile) vfFile).getVFS()
058:                            .getVirtualFile(
059:                                    ((VersionedVirtualFile) vfFile)
060:                                            .getLiveVersionPath())
061:                            .getResource();
062:                }
063:                return this .getIcon(vfFile, false);
064:            }
065:
066:            /* (non-Javadoc)
067:             * @see com.simulacramedia.vfs.VirtualFileView#getIcon(com.simulacramedia.vfs.VirtualFile, boolean)
068:             */
069:            public Icon getIcon(VirtualFile vfFile, boolean bIsDirectoryOpen) {
070:                if ((vfFile.getState() == VirtualFile.STATE_HISTORICAL || vfFile
071:                        .getState() == VirtualFile.STATE_PENDING)
072:                        && ((VersionedVirtualFile) vfFile).getLiveVersionPath() != null) {
073:                    vfFile = ((VersionedVirtualFile) vfFile).getVFS()
074:                            .getVirtualFile(
075:                                    ((VersionedVirtualFile) vfFile)
076:                                            .getLiveVersionPath())
077:                            .getResource();
078:                }
079:                return this .getIcon(vfFile.getFullPath(), vfFile.isDirectory(),
080:                        bIsDirectoryOpen);
081:            }
082:
083:            /* (non-Javadoc)
084:             * @see com.simulacramedia.vfs.VirtualFileView#getIcon(com.simulacramedia.vfs.VirtualFile, boolean)
085:             */
086:            private Icon getIcon(String sFullPath, boolean bIsDirectory,
087:                    boolean bIsDirectoryOpen) {
088:
089:                if (bIsDirectory) {
090:                    if (sFullPath.startsWith(HarmonisePaths.PATH_PROPERTIES)
091:                            || sFullPath
092:                                    .startsWith(HarmonisePaths.PATH_RBS_PROPS)) {
093:                        return IconManager.getInstance().getIcon(
094:                                "16-property-container.gif");
095:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_VALUES)
096:                            || sFullPath
097:                                    .startsWith(HarmonisePaths.PATH_RBS_VALS)) {
098:                        return IconManager.getInstance().getIcon(
099:                                "16-value-container.gif");
100:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_FLASH)) {
101:                        if (bIsDirectoryOpen) {
102:                            return IconManager.getInstance().getIcon(
103:                                    "16-flash-folder-open.gif");
104:                        } else {
105:                            return IconManager.getInstance().getIcon(
106:                                    "16-flash-folder.gif");
107:                        }
108:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_IMAGES)) {
109:                        if (bIsDirectoryOpen) {
110:                            return IconManager.getInstance().getIcon(
111:                                    "16-image-folder-open.gif");
112:                        } else {
113:                            return IconManager.getInstance().getIcon(
114:                                    "16-image-folder.gif");
115:                        }
116:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_EMAIL)) {
117:                        if (bIsDirectoryOpen) {
118:                            return IconManager.getInstance().getIcon(
119:                                    "16-email-folder-open.gif");
120:                        } else {
121:                            return IconManager.getInstance().getIcon(
122:                                    "16-email-folder.gif");
123:                        }
124:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_LINKS)) {
125:                        if (bIsDirectoryOpen) {
126:                            return IconManager.getInstance().getIcon(
127:                                    "16-link-folder-open.gif");
128:                        } else {
129:                            return IconManager.getInstance().getIcon(
130:                                    "16-link-folder.gif");
131:                        }
132:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_PDF)) {
133:                        if (bIsDirectoryOpen) {
134:                            return IconManager.getInstance().getIcon(
135:                                    "16-pdf-folder-open.gif");
136:                        } else {
137:                            return IconManager.getInstance().getIcon(
138:                                    "16-pdf-folder.gif");
139:                        }
140:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_MOVIES)) {
141:                        if (bIsDirectoryOpen) {
142:                            return IconManager.getInstance().getIcon(
143:                                    "16-movie-folder-open.gif");
144:                        } else {
145:                            return IconManager.getInstance().getIcon(
146:                                    "16-movie-folder.gif");
147:                        }
148:                    } else if (sFullPath
149:                            .startsWith(HarmonisePaths.PATH_NEWSLETTER_DRAFT)) {
150:                        return IconManager.getInstance().getIcon(
151:                                "16-newsletter-draft.gif");
152:                    } else if (sFullPath
153:                            .startsWith(HarmonisePaths.PATH_NEWSLETTER_SENT)) {
154:                        return IconManager.getInstance().getIcon(
155:                                "16-newsletter-sent.gif");
156:                    } else if (sFullPath
157:                            .startsWith(HarmonisePaths.PATH_NEWSLETTER_OUTBOX)) {
158:                        return IconManager.getInstance().getIcon(
159:                                "16-newsletter-outbox.gif");
160:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_USERS)) {
161:                        return IconManager.getInstance().getIcon(
162:                                "16-user-container.gif");
163:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_ASSETS)) {
164:                        if (bIsDirectoryOpen) {
165:                            return IconManager.getInstance().getIcon(
166:                                    "16-assets-folder-open.gif");
167:                        } else {
168:                            return IconManager.getInstance().getIcon(
169:                                    "16-assets-folder.gif");
170:                        }
171:                    } else if (sFullPath
172:                            .startsWith(HarmonisePaths.PATH_INCLUDES)) {
173:                        if (bIsDirectoryOpen) {
174:                            return IconManager.getInstance().getIcon(
175:                                    "16-includes-folder-open.gif");
176:                        } else {
177:                            return IconManager.getInstance().getIcon(
178:                                    "16-includes-folder.gif");
179:                        }
180:                    } else if (sFullPath
181:                            .startsWith(HarmonisePaths.PATH_OBJECT_TEMPLATES)) {
182:                        if (bIsDirectoryOpen) {
183:                            return IconManager.getInstance().getIcon(
184:                                    "16-object-template-folder-open.gif");
185:                        } else {
186:                            return IconManager.getInstance().getIcon(
187:                                    "16-object-template-folder.gif");
188:                        }
189:                    } else if (sFullPath
190:                            .startsWith(HarmonisePaths.PATH_PAGE_DEFINITION)) {
191:                        if (bIsDirectoryOpen) {
192:                            return IconManager.getInstance().getIcon(
193:                                    "16-page-definition-folder-open.gif");
194:                        } else {
195:                            return IconManager.getInstance().getIcon(
196:                                    "16-page-definition-folder.gif");
197:                        }
198:                    } else if (sFullPath
199:                            .startsWith(HarmonisePaths.PATH_SITE_ASSETS_FLASH)) {
200:                        if (bIsDirectoryOpen) {
201:                            return IconManager.getInstance().getIcon(
202:                                    "16-flash-folder-open.gif");
203:                        } else {
204:                            return IconManager.getInstance().getIcon(
205:                                    "16-flash-folder.gif");
206:                        }
207:                    } else if (sFullPath
208:                            .startsWith(HarmonisePaths.PATH_SITE_ASSETS)) {
209:                        if (bIsDirectoryOpen) {
210:                            return IconManager.getInstance().getIcon(
211:                                    "16-assets-folder-open.gif");
212:                        } else {
213:                            return IconManager.getInstance().getIcon(
214:                                    "16-assets-folder.gif");
215:                        }
216:                    } else if (sFullPath
217:                            .startsWith(HarmonisePaths.PATH_REPORTS_QUERIES)) {
218:                        if (bIsDirectoryOpen) {
219:                            return IconManager.getInstance().getIcon(
220:                                    "16-query-folder-open.gif");
221:                        } else {
222:                            return IconManager.getInstance().getIcon(
223:                                    "16-query-folder.gif");
224:                        }
225:                    } else if (sFullPath
226:                            .startsWith(HarmonisePaths.PATH_REPORTS)) {
227:                        if (bIsDirectoryOpen) {
228:                            return IconManager.getInstance().getIcon(
229:                                    "16-report-folder-open.gif");
230:                        } else {
231:                            return IconManager.getInstance().getIcon(
232:                                    "16-report-folder.gif");
233:                        }
234:                    } else if (sFullPath
235:                            .startsWith(HarmonisePaths.PATH_PAGE_TEMPLATES)) {
236:                        if (bIsDirectoryOpen) {
237:                            return IconManager.getInstance().getIcon(
238:                                    "16-template-folder-open.gif");
239:                        } else {
240:                            return IconManager.getInstance().getIcon(
241:                                    "16-template-folder.gif");
242:                        }
243:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_XSLT)) {
244:                        if (bIsDirectoryOpen) {
245:                            return IconManager.getInstance().getIcon(
246:                                    "16-xslt-folder-open.gif");
247:                        } else {
248:                            return IconManager.getInstance().getIcon(
249:                                    "16-xslt-folder.gif");
250:                        }
251:                    } else if (sFullPath
252:                            .startsWith(HarmonisePaths.PATH_DISPLAY)) {
253:                        if (bIsDirectoryOpen) {
254:                            return IconManager.getInstance().getIcon(
255:                                    "16-template-container.gif");
256:                        } else {
257:                            return IconManager.getInstance().getIcon(
258:                                    "16-template-container.gif");
259:                        }
260:                    } else if (sFullPath
261:                            .startsWith(HarmonisePaths.PATH_CONTENT)) {
262:                        if (bIsDirectoryOpen) {
263:                            return IconManager.getInstance().getIcon(
264:                                    "16-section-open.gif");
265:                        } else {
266:                            return IconManager.getInstance().getIcon(
267:                                    "16-section.gif");
268:                        }
269:                    } else if (sFullPath
270:                            .startsWith(HarmonisePaths.PATH_WORKFLOW_DEFINITIONS)) {
271:                        if (bIsDirectoryOpen) {
272:                            return IconManager.getInstance().getIcon(
273:                                    "16-folder-open.gif");
274:                        } else {
275:                            return IconManager.getInstance().getIcon(
276:                                    "16-folder.gif");
277:                        }
278:                    } else if (sFullPath
279:                            .startsWith(HarmonisePaths.PATH_WORKFLOW_PROPS)) {
280:                        if (bIsDirectoryOpen) {
281:                            return IconManager.getInstance().getIcon(
282:                                    "16-folder-open.gif");
283:                        } else {
284:                            return IconManager.getInstance().getIcon(
285:                                    "16-folder.gif");
286:                        }
287:                    } else if (sFullPath
288:                            .startsWith(HarmonisePaths.PATH_WORKFLOW_STAGES)) {
289:                        if (bIsDirectoryOpen) {
290:                            return IconManager.getInstance().getIcon(
291:                                    "16-folder-open.gif");
292:                        } else {
293:                            return IconManager.getInstance().getIcon(
294:                                    "16-folder.gif");
295:                        }
296:                    } else if (sFullPath.equals(HarmonisePaths.PATH_ARCHIVE)) {
297:                        return IconManager.getInstance().getIcon(
298:                                "16-archive-container.gif");
299:                    } else if (sFullPath
300:                            .equals(HarmonisePaths.PATH_COMPOSITION)) {
301:                        return IconManager.getInstance().getIcon(
302:                                "16-composition-container.gif");
303:                    } else if (sFullPath
304:                            .startsWith(HarmonisePaths.PATH_METADATA)) {
305:                        return IconManager.getInstance().getIcon(
306:                                "16-property-container.gif");
307:                    } else if (sFullPath
308:                            .startsWith(HarmonisePaths.PATH_NEWSLETTER)) {
309:                        return IconManager.getInstance().getIcon(
310:                                "16-newsletter.gif");
311:                    } else if (sFullPath
312:                            .startsWith(HarmonisePaths.PATH_REPORTS)) {
313:                        return IconManager.getInstance().getIcon(
314:                                "16-report.gif");
315:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_USERS)) {
316:                        return IconManager.getInstance().getIcon(
317:                                "16-user-container.gif");
318:                    } else if (sFullPath
319:                            .startsWith(HarmonisePaths.PATH_WEBSITE)) {
320:                        return IconManager.getInstance().getIcon(
321:                                "16-website-container.gif");
322:                    } else if (sFullPath
323:                            .startsWith(HarmonisePaths.PATH_ARCHIVE)) {
324:                        return this .getIcon(sFullPath
325:                                .replaceAll("/Archive", ""), bIsDirectory,
326:                                bIsDirectoryOpen);
327:                    } else if (bIsDirectoryOpen) {
328:                        return IconManager.getInstance().getIcon(
329:                                "16-section-open.gif");
330:                    } else {
331:                        return IconManager.getInstance().getIcon(
332:                                "16-section.gif");
333:                    }
334:                } else {
335:                    if (sFullPath.startsWith(HarmonisePaths.PATH_USERS)) {
336:                        return IconManager.getInstance().getIcon("16-user.gif");
337:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_FLASH)) {
338:                        return IconManager.getInstance()
339:                                .getIcon("16-movie.gif");
340:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_PDF)) {
341:                        return IconManager.getInstance().getIcon("16-pdf.gif");
342:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_MOVIES)) {
343:                        return IconManager.getInstance()
344:                                .getIcon("16-movie.gif");
345:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_LINKS)) {
346:                        return IconManager.getInstance().getIcon("16-link.gif");
347:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_LINKS)) {
348:                        return IconManager.getInstance().getIcon("16-link.gif");
349:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_EMAIL)) {
350:                        return IconManager.getInstance()
351:                                .getIcon("16-email.gif");
352:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_IMAGES)) {
353:                        return IconManager.getInstance()
354:                                .getIcon("16-image.gif");
355:                    } else if (sFullPath
356:                            .startsWith(HarmonisePaths.PATH_PROPERTIES)) {
357:                        return IconManager.getInstance().getIcon(
358:                                "16-property.gif");
359:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_VALUES)
360:                            || sFullPath
361:                                    .startsWith(HarmonisePaths.PATH_RBS_VALS)) {
362:                        return IconManager.getInstance()
363:                                .getIcon("16-value.gif");
364:                    } else if (sFullPath
365:                            .startsWith(HarmonisePaths.PATH_NEWSLETTER)) {
366:                        return IconManager.getInstance().getIcon(
367:                                "16-newsletter.gif");
368:                    } else if (sFullPath
369:                            .startsWith(HarmonisePaths.PATH_PAGE_TEMPLATES)) {
370:                        return IconManager.getInstance().getIcon(
371:                                "16-template.gif");
372:                    } else if (sFullPath
373:                            .startsWith(HarmonisePaths.PATH_INCLUDES)) {
374:                        return IconManager.getInstance().getIcon(
375:                                "16-includes.gif");
376:                    } else if (sFullPath
377:                            .startsWith(HarmonisePaths.PATH_OBJECT_TEMPLATES)) {
378:                        return IconManager.getInstance().getIcon(
379:                                "16-object-template.gif");
380:                    } else if (sFullPath
381:                            .startsWith(HarmonisePaths.PATH_PAGE_DEFINITION)) {
382:                        return IconManager.getInstance().getIcon(
383:                                "16-page-definition.gif");
384:                    } else if (sFullPath
385:                            .startsWith(HarmonisePaths.PATH_REPORTS_QUERIES)) {
386:                        return IconManager.getInstance()
387:                                .getIcon("16-query.gif");
388:                    } else if (sFullPath
389:                            .startsWith(HarmonisePaths.PATH_SITE_ASSETS_FLASH)) {
390:                        return IconManager.getInstance()
391:                                .getIcon("16-movie.gif");
392:                    } else if (sFullPath
393:                            .startsWith(HarmonisePaths.PATH_REPORTS_OUTPUT)) {
394:                        return IconManager.getInstance().getIcon(
395:                                "16-report.gif");
396:                    } else if (sFullPath.startsWith(HarmonisePaths.PATH_XSLT)) {
397:                        return IconManager.getInstance().getIcon("16-xslt.gif");
398:                    } else if (sFullPath
399:                            .startsWith(HarmonisePaths.PATH_DISPLAY)) {
400:                        return IconManager.getInstance().getIcon("16-xslt.gif");
401:                    } else if (sFullPath
402:                            .startsWith(HarmonisePaths.PATH_WORKFLOW_DEFINITIONS)) {
403:                        return IconManager.getInstance().getIcon(
404:                                "16-workflow-container.gif");
405:                    } else if (sFullPath
406:                            .startsWith(HarmonisePaths.PATH_WORKFLOW_PROPS)) {
407:                        return IconManager.getInstance().getIcon(
408:                                "16-command-change-status.gif");
409:                    } else if (sFullPath
410:                            .startsWith(HarmonisePaths.PATH_WORKFLOW_STAGES)) {
411:                        return IconManager.getInstance().getIcon(
412:                                "16-workflow-container.gif");
413:                    } else if (sFullPath
414:                            .startsWith(HarmonisePaths.PATH_ARCHIVE)) {
415:                        return this .getIcon(sFullPath
416:                                .replaceAll("/Archive", ""), bIsDirectory,
417:                                bIsDirectoryOpen);
418:                    } else {
419:                        return IconManager.getInstance().getIcon(
420:                                "16-document.gif");
421:                    }
422:                }
423:            }
424:
425:            /* (non-Javadoc)
426:             * @see com.simulacramedia.vfs.VirtualFileView#getDisplayName(com.simulacramedia.vfs.VirtualFile)
427:             */
428:            public String getDisplayName(VirtualFile vfFile) {
429:                try {
430:                    VersionedVirtualFile vvfFile = (VersionedVirtualFile) vfFile;
431:                    PropertyInstance titleProp = vfFile.getProperty(
432:                            NamespaceType.OHRM.getURI(), "title");
433:                    if (titleProp != null
434:                            && titleProp.getValues().size() > 0
435:                            && !((StringValue) titleProp.getValues().get(0))
436:                                    .getValue().equals("")) {
437:                        return ((StringValue) titleProp.getValues().get(0))
438:                                .getValue();
439:                    } else {
440:                        if (vvfFile.getLiveVersionPath() != null) {
441:                            VirtualFile vfLive = vvfFile.getVFS()
442:                                    .getVirtualFile(
443:                                            vvfFile.getLiveVersionPath())
444:                                    .getResource();
445:                            return vfLive.getFileName();
446:                        } else {
447:                            return vvfFile.getFileName();
448:                        }
449:                    }
450:                } catch (Exception e) {
451:                    e.printStackTrace(System.err);
452:                    return vfFile.getFileName();
453:                }
454:            }
455:
456:            /* (non-Javadoc)
457:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getFileSystemIcon()
458:             */
459:            public Icon getFileSystemIcon() {
460:                return null;
461:            }
462:
463:            /* (non-Javadoc)
464:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getFileSystemDisplayName()
465:             */
466:            public String getFileSystemDisplayName() {
467:                return null;
468:            }
469:
470:            /* (non-Javadoc)
471:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getVFSIndependantProperty(java.lang.String)
472:             */
473:            public PropertyInstance getVFSIndependantProperty(
474:                    String sIndependantPropName) {
475:                return null;
476:            }
477:
478:            /* (non-Javadoc)
479:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getModificationDate()
480:             */
481:            public String getModificationDate(VirtualFile vfFile) {
482:                PropertyInstance prop = vfFile.getProperty(
483:                        PropFind.WEBDAV_NAMESPACE, "getlastmodified");
484:                if (prop != null && prop.getValues().size() > 0) {
485:                    String sDate = ((StringValue) prop.getValues().get(0))
486:                            .getValue();
487:                    String sFormattedDate = null;
488:
489:                    if (sDate != null && sDate.length() > 0) {
490:                        try {
491:                            sFormattedDate = DateFormatter.format(sDate,
492:                                    DISPLAY_DATE_FORMAT);
493:                        } catch (ParseException e) {
494:                            // just return the original
495:                            sFormattedDate = sDate;
496:                        }
497:                    } else {
498:                        sFormattedDate = "";
499:                    }
500:                    return sFormattedDate;
501:                } else {
502:                    return "";
503:                }
504:            }
505:
506:            /* (non-Javadoc)
507:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getContentType(com.simulacramedia.vfs.VirtualFile)
508:             */
509:            public String getContentType(VirtualFile vfFile) {
510:                PropertyInstance prop = vfFile.getProperty("DAV:",
511:                        "getcontenttype");
512:                if (prop != null && prop.getValues().size() > 0) {
513:                    return ((StringValue) prop.getValues().get(0)).getValue();
514:                } else {
515:                    return "";
516:                }
517:            }
518:
519:            /* (non-Javadoc)
520:             * @see com.simulacramedia.vfs.VirtualFileSystemView#setContentType(com.simulacramedia.vfs.VirtualFile, java.lang.String)
521:             */
522:            public void setContentType(VirtualFile vfFile, String sContentType) {
523:                PropertyInstance propInst = new PropertyInstance(
524:                        NamespaceType.DAV.getURI(), "getcontenttype");
525:                propInst.setVirtualFile(vfFile);
526:                StringValue val = (StringValue) propInst.getNewValueInstance();
527:                val.setValue(sContentType);
528:                propInst.addValueWithoutFiringVirtualFileEvent(val);
529:                vfFile.addProperty(propInst);
530:            }
531:
532:            /* (non-Javadoc)
533:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getSummary(com.simulacramedia.vfs.VirtualFile)
534:             */
535:            public String getSummary(VirtualFile vfFile) {
536:                try {
537:                    VersionedVirtualFile vvfFile = (VersionedVirtualFile) vfFile;
538:                    if (vvfFile.getLiveVersionPath() != null) {
539:                        VirtualFile vfLive = vvfFile.getVFS().getVirtualFile(
540:                                vvfFile.getLiveVersionPath()).getResource();
541:                        PropertyInstance titleProp = vfLive.getProperty(
542:                                NamespaceType.OHRM.getURI(), "description");
543:                        if (titleProp != null
544:                                && titleProp.getValues().size() > 0
545:                                && !((StringValue) titleProp.getValues().get(0))
546:                                        .getValue().equals("")) {
547:                            return ((StringValue) titleProp.getValues().get(0))
548:                                    .getValue();
549:                        } else {
550:                            return "";
551:                        }
552:                    } else {
553:                        PropertyInstance titleProp = vfFile.getProperty(
554:                                NamespaceType.OHRM.getURI(), "description");
555:                        if (titleProp != null
556:                                && titleProp.getValues().size() > 0
557:                                && !((StringValue) titleProp.getValues().get(0))
558:                                        .getValue().equals("")) {
559:                            return ((StringValue) titleProp.getValues().get(0))
560:                                    .getValue();
561:                        } else {
562:                            return "";
563:                        }
564:                    }
565:                } catch (Exception e) {
566:                    e.printStackTrace(System.err);
567:                    return "";
568:                }
569:            }
570:
571:            /* (non-Javadoc)
572:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getLogicalFileName(com.simulacramedia.vfs.VirtualFile)
573:             */
574:            public String getLogicalFileName(VirtualFile vfFile) {
575:                try {
576:                    VersionedVirtualFile vvfFile = (VersionedVirtualFile) vfFile;
577:                    if (vvfFile.getLiveVersionPath() != null) {
578:                        VirtualFile vfLive = vvfFile.getVFS().getVirtualFile(
579:                                vvfFile.getLiveVersionPath()).getResource();
580:                        return vfLive.getFileName();
581:                    } else {
582:                        return vfFile.getFileName();
583:                    }
584:                } catch (Exception e) {
585:                    e.printStackTrace(System.err);
586:                    return vfFile.getFileName();
587:                }
588:            }
589:
590:            /* (non-Javadoc)
591:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getPublicationDate(com.simulacramedia.vfs.VirtualFile)
592:             */
593:            public String getPublicationDate(VirtualFile vfFile) {
594:                PropertyInstance prop = vfFile.getProperty(NamespaceType.OHRM
595:                        .getURI(), "START");
596:                if (prop != null && prop.getValues().size() > 0) {
597:                    String sDate = null;
598:                    String sFormattedDate = null;
599:                    try {
600:                        sDate = ((DAVDateTimeValue) prop.getValues().get(0))
601:                                .getValue();
602:                    } catch (ClassCastException cce) {
603:                        cce.printStackTrace();
604:                    }
605:                    if (sDate != null && sDate.length() > 0) {
606:                        try {
607:                            sFormattedDate = DateFormatter.format(sDate,
608:                                    DISPLAY_DATE_FORMAT);
609:                        } catch (ParseException e) {
610:                            // just return the original
611:                            sFormattedDate = sDate;
612:                        }
613:                    } else {
614:                        sFormattedDate = "none";
615:                    }
616:                    return sFormattedDate;
617:                } else {
618:                    return "none";
619:                }
620:            }
621:
622:            /* (non-Javadoc)
623:             * @see com.simulacramedia.vfs.VirtualFileSystemView#getArchiveDate(com.simulacramedia.vfs.VirtualFile)
624:             */
625:            public String getArchiveDate(VirtualFile vfFile) {
626:                PropertyInstance prop = vfFile.getProperty(NamespaceType.OHRM
627:                        .getURI(), "archivedate");
628:                if (prop != null && prop.getValues().size() > 0) {
629:                    String sDate = ((StringValue) prop.getValues().get(0))
630:                            .getValue();
631:                    String sFormattedDate = null;
632:                    if (sDate != null && sDate.length() > 0) {
633:                        try {
634:                            sFormattedDate = DateFormatter.format(sDate,
635:                                    DISPLAY_DATE_FORMAT);
636:                        } catch (ParseException e) {
637:                            // just return the original
638:                            sFormattedDate = sDate;
639:                        }
640:                    } else {
641:                        sFormattedDate = "none";
642:                    }
643:                    return sFormattedDate;
644:                } else {
645:                    return "none";
646:                }
647:            }
648:
649:            public static void main(String args[]) {
650:                String temp = null;
651:                String sFormattedDate = null;
652:                try {
653:                    temp = DateFormatter
654:                            .format("Thu, 15 Apr 2004 16:51:29 GMT",
655:                                    "yyyy-MM-dd HH:mm");
656:                } catch (ParseException e) {
657:                    e.printStackTrace();
658:                }
659:                System.out.println(temp);
660:            }
661:
662:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.