Source Code Cross Referenced for DefaultWebTreeNode.java in  » Content-Management-System » openedit » com » openedit » webui » tree » 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 » openedit » com.openedit.webui.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        Copyright (c) 2003 eInnovation Inc. All rights reserved
003:
004:        This library is free software; you can redistribute it and/or modify it under the terms
005:        of the GNU Lesser General Public License as published by the Free Software Foundation;
006:        either version 2.1 of the License, or (at your option) any later version.
007:
008:        This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
009:        without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
010:        See the GNU Lesser General Public License for more details.
011:         */
012:
013:        package com.openedit.webui.tree;
014:
015:        import java.util.ArrayList;
016:        import java.util.List;
017:
018:        import com.openedit.util.strainer.Filter;
019:
020:        /**
021:         * This class represents a node in a <code>{@link DefaultWebTreeModel}</code>. It has the
022:         * attributes most people will need: name, URL, and icon URL.  Most of the methods in
023:         * <code>DefaultWebTreeModel</code> delegate to this class.
024:         *
025:         * @author Eric Galluzzo
026:         */
027:        public class DefaultWebTreeNode {
028:            protected static int staticNextID = 0;
029:            protected List fieldChildren;
030:            protected String fieldIconURL;
031:            protected String fieldName;
032:            protected boolean fieldLeaf;
033:            protected String fieldID;
034:            protected Filter fieldFilter;
035:            protected DefaultWebTreeNode fieldParent;
036:            protected String fieldIconSet;
037:
038:            /**
039:             * Create a tree node with the given name, without an icon or link.
040:             *
041:             * @param inName DOCUMENT ME!
042:             */
043:            public DefaultWebTreeNode(String inName) {
044:                setName(inName);
045:                fieldID = String.valueOf(staticNextID++);
046:            }
047:
048:            public DefaultWebTreeNode(String inId, String inName) {
049:                setName(inName);
050:                fieldID = inId;
051:            }
052:
053:            /**
054:             * Get the child at the given position in this node.
055:             *
056:             * @param inIndex DOCUMENT ME!
057:             *
058:             * @return
059:             */
060:            public DefaultWebTreeNode getChild(int inIndex) {
061:                return (DefaultWebTreeNode) getChildren().get(inIndex);
062:            }
063:
064:            /**
065:             * Get the number of children that this node has.
066:             *
067:             * @return
068:             */
069:            public int getChildCount() {
070:                return getChildren().size();
071:            }
072:
073:            /**
074:             * Gets the children.
075:             *
076:             * @return Returns a List
077:             */
078:            public List getChildren() {
079:                if (fieldChildren == null) {
080:                    fieldChildren = new ArrayList();
081:                }
082:
083:                return fieldChildren;
084:            }
085:
086:            /**
087:             * Gets the ID of this node, which is unique within the VM for the life of the VM (unless you
088:             * do weird things with classloaders).
089:             *
090:             * @return Returns an int
091:             */
092:            public String getID() {
093:                return fieldID;
094:            }
095:
096:            /**
097:             * Sets the icon URL.
098:             *
099:             * @param iconURL The icon URL to set
100:             */
101:            public void setIconURL(String iconURL) {
102:                fieldIconURL = iconURL;
103:            }
104:
105:            /**
106:             * Gets the icon URL.
107:             *
108:             * @return Returns a String
109:             */
110:            public String getIconURL() {
111:                return fieldIconURL;
112:            }
113:
114:            /**
115:             * Get the index of the given child in this node
116:             *
117:             * @param inChild DOCUMENT ME!
118:             *
119:             * @return The index, or -1 if the child could not be found
120:             */
121:            public int getIndexOfChild(DefaultWebTreeNode inChild) {
122:                return getChildren().indexOf(inChild);
123:            }
124:
125:            /**
126:             * Set whether this node is a leaf.
127:             *
128:             * @param inLeaf DOCUMENT ME!
129:             */
130:            public void setLeaf(boolean inLeaf) {
131:                fieldLeaf = inLeaf;
132:            }
133:
134:            /**
135:             * Determine whether this node is a leaf node.
136:             *
137:             * @return
138:             */
139:            public boolean isLeaf() {
140:                return fieldLeaf;
141:            }
142:
143:            /**
144:             * Sets the name.
145:             *
146:             * @param name The name to set
147:             */
148:            public void setName(String name) {
149:                fieldName = name;
150:            }
151:
152:            /**
153:             * Gets the name.
154:             *
155:             * @return Returns a String
156:             */
157:            public String getName() {
158:                return fieldName;
159:            }
160:
161:            /**
162:             * Gets the URL.
163:             *
164:             * @return Returns a String
165:             */
166:            public String getURL() {
167:                if (getParent() != null) {
168:                    String p = getParent().getURL();
169:                    if (p.endsWith("/")) {
170:                        return p + getName();
171:                    } else {
172:                        return p + "/" + getName();
173:                    }
174:                } else {
175:                    return getName(); //the root does not need a special URL since it is part of the base path
176:                }
177:            }
178:
179:            /**
180:             * Add the given child to this node's children.
181:             *
182:             * @param inNode DOCUMENT ME!
183:             */
184:            public void addChild(DefaultWebTreeNode inNode) {
185:                getChildren().add(inNode);
186:                inNode.setParent(this );
187:            }
188:
189:            /**
190:             * DOCME
191:             */
192:            public void reloadChildren() {
193:                //nothing to do?
194:            }
195:
196:            public DefaultWebTreeNode getParent() {
197:                return fieldParent;
198:            }
199:
200:            public void setParent(DefaultWebTreeNode inParent) {
201:                fieldParent = inParent;
202:            }
203:
204:            public Filter getFilter() {
205:                return fieldFilter;
206:            }
207:
208:            public void setFilter(Filter inFilter) {
209:                fieldFilter = inFilter;
210:            }
211:
212:            public boolean hasLoadedChildren() {
213:                return fieldChildren != null;
214:            }
215:
216:            public String getIconSet() {
217:                return fieldIconSet;
218:            }
219:
220:            public void setIconSet(String inIconSet) {
221:                fieldIconSet = inIconSet;
222:            }
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.