Source Code Cross Referenced for ResourcesListImpl.java in  » Project-Management » memoranda » net » sf » memoranda » 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 » Project Management » memoranda » net.sf.memoranda 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * ResourcesListImpl.java
003:         * Created on 24.03.2003, 18:30:31 Alex
004:         * Package: net.sf.memoranda
005:         *
006:         * @author Alex V. Alishevskikh, alex@openmechanics.net
007:         * Copyright (c) 2003 Memoranda Team. http://memoranda.sf.net
008:         */package net.sf.memoranda;
009:
010:        import java.util.Vector;
011:        import java.io.File;
012:
013:        import net.sf.memoranda.util.Util;
014:        import nu.xom.Attribute;
015:        import nu.xom.Document;
016:        import nu.xom.Element;
017:        import nu.xom.Elements;
018:
019:        /**
020:         *
021:         */
022:        /*$Id: ResourcesListImpl.java,v 1.5 2007/03/20 06:21:46 alexeya Exp $*/
023:        public class ResourcesListImpl implements  ResourcesList {
024:
025:            private Project _project = null;
026:            private Document _doc = null;
027:            private Element _root = null;
028:
029:            /**
030:             * Constructor for TaskListImpl.
031:             */
032:            public ResourcesListImpl(Document doc, Project prj) {
033:                _doc = doc;
034:                _root = _doc.getRootElement();
035:                _project = prj;
036:            }
037:
038:            public ResourcesListImpl(Project prj) {
039:                _root = new Element("resources-list");
040:                _doc = new Document(_root);
041:                _project = prj;
042:            }
043:
044:            public Vector getAllResources() {
045:                Vector v = new Vector();
046:                Elements rs = _root.getChildElements("resource");
047:                for (int i = 0; i < rs.size(); i++)
048:                    v.add(new Resource(rs.get(i).getAttribute("path")
049:                            .getValue(), rs.get(i).getAttribute(
050:                            "isInetShortcut") != null, rs.get(i).getAttribute(
051:                            "isProjectFile") != null));
052:                return v;
053:            }
054:
055:            /**
056:             * @see net.sf.memoranda.ResourcesList#getResource(java.lang.String)
057:             */
058:            public Resource getResource(String path) {
059:                Elements rs = _root.getChildElements("resource");
060:                for (int i = 0; i < rs.size(); i++)
061:                    if (rs.get(i).getAttribute("path").getValue().equals(path))
062:                        return new Resource(rs.get(i).getAttribute("path")
063:                                .getValue(), rs.get(i).getAttribute(
064:                                "isInetShortcut") != null, rs.get(i)
065:                                .getAttribute("isProjectFile") != null);
066:                return null;
067:            }
068:
069:            /**
070:             * @see net.sf.memoranda.ResourcesList#addResource(java.lang.String, java.lang.String)
071:             */
072:            /*public void addResource(String path, String taskId) {
073:                Element el = new Element("resource");
074:                el.addAttribute(new Attribute("id", Util.generateId()));
075:                el.addAttribute(new Attribute("path", path));
076:                if (taskId != null) el.addAttribute(new Attribute("taskId", taskId));
077:                _root.appendChild(el);
078:            }*/
079:
080:            /**
081:             * @see net.sf.memoranda.ResourcesList#addResource(java.lang.String, boolean)
082:             */
083:            public void addResource(String path, boolean isInternetShortcut,
084:                    boolean isProjectFile) {
085:                Element el = new Element("resource");
086:                el.addAttribute(new Attribute("id", Util.generateId()));
087:                el.addAttribute(new Attribute("path", path));
088:                if (isInternetShortcut)
089:                    el.addAttribute(new Attribute("isInetShortcut", "true"));
090:                if (isProjectFile)
091:                    el.addAttribute(new Attribute("isProjectFile", "true"));
092:                _root.appendChild(el);
093:            }
094:
095:            public void addResource(String path) {
096:                addResource(path, false, false);
097:            }
098:
099:            /**
100:             * @see net.sf.memoranda.ResourcesList#removeResource(java.lang.String)
101:             */
102:            public void removeResource(String path) {
103:                Elements rs = _root.getChildElements("resource");
104:                for (int i = 0; i < rs.size(); i++)
105:                    if (rs.get(i).getAttribute("path").getValue().equals(path)) {
106:                        if (getResource(path).isProjectFile()) {
107:                            File f = new File(path);
108:                            System.out.println("[DEBUG] Removing file " + path);
109:                            f.delete();
110:                        }
111:                        _root.removeChild(rs.get(i));
112:                    }
113:            }
114:
115:            /**
116:             * @see net.sf.memoranda.ResourcesList#getAllResourcesCount()
117:             */
118:            public int getAllResourcesCount() {
119:                return _root.getChildElements("resource").size();
120:            }
121:
122:            /**
123:             * @see net.sf.memoranda.ResourcesList#getXMLContent()
124:             */
125:            public Document getXMLContent() {
126:                return _doc;
127:            }
128:
129:            /**
130:             * @see net.sf.memoranda.ResourcesList#getResourcesForTask(java.lang.String)
131:             */
132:            /*public Vector getResourcesForTask(String taskId) {
133:                Vector v = new Vector();
134:                Elements rs = _root.getChildElements("resource");
135:                for (int i = 0; i < rs.size(); i++)
136:                    if (rs.get(i).getAttribute("taskId").getValue().equals(taskId))
137:                        v.add(rs.get(i).getAttribute("path").getValue());
138:                return v;
139:            }*/
140:
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.