Source Code Cross Referenced for RemoteResourceWrapperNode.java in  » Web-Server » Jigsaw » org » w3c » jigadmin » editors » 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 » Web Server » Jigsaw » org.w3c.jigadmin.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // RemoteResourceWrapperNode.java
002:        // $Id: RemoteResourceWrapperNode.java,v 1.13 2000/08/16 21:37:30 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1998.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigadmin.editors;
007:
008:        import java.awt.Cursor;
009:
010:        import javax.swing.JTree;
011:        import javax.swing.tree.TreeNode;
012:        import javax.swing.tree.TreePath;
013:        import javax.swing.tree.MutableTreeNode;
014:
015:        import java.util.Enumeration;
016:        import java.util.Vector;
017:
018:        import org.w3c.jigadmin.RemoteResourceWrapper;
019:        import org.w3c.jigadmin.PropertyManager;
020:        import org.w3c.jigadmin.gui.Message;
021:
022:        import org.w3c.jigsaw.admin.RemoteAccessException;
023:
024:        import org.w3c.tools.sorter.Sorter;
025:
026:        import org.w3c.util.ArrayEnumeration;
027:
028:        /**
029:         * The TreeNode for Resources
030:         * @version $Revision: 1.13 $
031:         * @author  Benoît Mahé (bmahe@w3.org)
032:         */
033:        public class RemoteResourceWrapperNode implements  MutableTreeNode,
034:                RemoteNode {
035:
036:            protected RemoteResourceWrapper rrw = null;
037:            protected RemoteResourceWrapperNode parent = null;
038:            protected String name = null;
039:            protected Vector children = null;
040:
041:            /**
042:             * Load the children of this node.
043:             */
044:            protected synchronized void loadChildren() {
045:                String names[] = null;
046:                RemoteResourceWrapper child = null;
047:
048:                children = new Vector();
049:
050:                try {
051:                    names = rrw.getResource().enumerateResourceIdentifiers();
052:                } catch (RemoteAccessException ex) {
053:                    Message.showErrorMessage(rrw, ex);
054:                }
055:                if (names == null)
056:                    return;
057:                Sorter.sortStringArray(names, true);
058:                for (int i = 0; i < names.length; i++) {
059:                    try {
060:                        child = rrw.getChildResource(names[i]);
061:                    } catch (RemoteAccessException ex) {
062:                        Message.showErrorMessage(rrw, ex, names[i]);
063:                    }
064:                    if (child != null) {
065:                        RemoteResourceWrapperNode node = new RemoteResourceWrapperNode(
066:                                this , child, names[i]);
067:                        children.add(node);
068:                    }
069:                }
070:            }
071:
072:            //RemoteNode part
073:            /**
074:             * Invoked whenever this node is about to be expanded.
075:             */
076:            public void nodeWillExpand() {
077:                children = null;
078:            }
079:
080:            /**
081:             * Invoked whenever this node is about to be collapsed.
082:             */
083:            public void nodeWillCollapse() {
084:                //children = null;
085:            }
086:
087:            /**
088:             * Get the associated RemoteResourceWrapper.
089:             * @return the associated RemoteResourceWrapper
090:             */
091:            public RemoteResourceWrapper getResourceWrapper() {
092:                return rrw;
093:            }
094:
095:            /**
096:             * Load the children if needed.
097:             */
098:            protected void acquireChildren() {
099:                rrw.getServerBrowser().setCursor(Cursor.WAIT_CURSOR);
100:                if (children == null)
101:                    loadChildren();
102:                rrw.getServerBrowser().setCursor(Cursor.DEFAULT_CURSOR);
103:            }
104:
105:            //TreeNode part
106:
107:            /**
108:             * Returns the child TreeNode at index childIndex.
109:             * @param childIndex the index of the child to return
110:             * @return a TreeNode instance
111:             */
112:            public TreeNode getChildAt(int childIndex) {
113:                acquireChildren();
114:                return (TreeNode) children.elementAt(childIndex);
115:            }
116:
117:            /**
118:             * Returns the number of children TreeNodes the receiver contains.
119:             * @return the number of children TreeNodes the receiver contains
120:             */
121:            public int getChildCount() {
122:                acquireChildren();
123:                return children.size();
124:            }
125:
126:            /**
127:             * Returns the parent TreeNode of the receiver.
128:             * @return a TreeNode
129:             */
130:            public TreeNode getParent() {
131:                return parent;
132:            }
133:
134:            /**
135:             * Returns the index of node in the receivers children. If the receiver 
136:             * does not contain node, -1 will be returned.
137:             * @return an int.
138:             */
139:            public int getIndex(TreeNode node) {
140:                acquireChildren();
141:                return children.indexOf(node);
142:            }
143:
144:            /**
145:             * Returns true if the receiver allows children.
146:             * @return an int.
147:             */
148:            public boolean getAllowsChildren() {
149:                try {
150:                    return rrw.getResource().isContainer();
151:                } catch (RemoteAccessException ex) {
152:                    Message.showErrorMessage(rrw, ex);
153:                }
154:                return false;
155:            }
156:
157:            /**
158:             * Returns true if the receiver is a leaf.
159:             * @return a boolean
160:             */
161:            public boolean isLeaf() {
162:                return (!getAllowsChildren());
163:            }
164:
165:            /**
166:             * Returns the children of the reciever as an Enumeration.
167:             * @return an Enumeration
168:             */
169:            public Enumeration children() {
170:                acquireChildren();
171:                return children.elements();
172:            }
173:
174:            //MutableTreeNode part
175:
176:            /**
177:             * Adds child to the receiver at index. child will be messaged
178:             * with setParent.
179:             * @param child the child to add.
180:             * @param index the index of the new child.
181:             */
182:            public void insert(MutableTreeNode child, int index) {
183:                acquireChildren();
184:                children.insertElementAt(child, index);
185:            }
186:
187:            /**
188:             * Removes the child at index from the receiver.
189:             * @param the index of the child to remove.
190:             */
191:            public void remove(int index) {
192:                acquireChildren();
193:                children.remove(index);
194:            }
195:
196:            /**
197:             * Removes node from the receiver. setParent will be messaged on node
198:             * @param node the node to remove
199:             */
200:            public void remove(MutableTreeNode node) {
201:                children.remove(node);
202:            }
203:
204:            /**
205:             * Resets the user object of the receiver to object.
206:             * @param object the new user object, actually the new identifier.
207:             */
208:            public void setUserObject(Object object) {
209:                if (object instanceof  String) {
210:                    PropertyManager pm = PropertyManager.getPropertyManager();
211:                    if (pm.isEditable(rrw)) {
212:                        try {
213:                            rrw.getResource().setValue("identifier",
214:                                    (String) object);
215:                            name = (String) object;
216:                        } catch (RemoteAccessException ex) {
217:                            Message.showErrorMessage(rrw, ex);
218:                        }
219:                    }
220:                }
221:            }
222:
223:            /**
224:             * Removes the receiver from its parent.
225:             */
226:            public void removeFromParent() {
227:                if (parent != null)
228:                    parent.remove(this );
229:            }
230:
231:            /**
232:             * Sets the parent of the receiver to newParent.
233:             * @param newParent the new parent.
234:             */
235:            public void setParent(MutableTreeNode newParent) {
236:                this .parent = (RemoteResourceWrapperNode) newParent;
237:            }
238:
239:            /**
240:             * Return the string reoresentation of this node.
241:             * @return its name
242:             */
243:            public String toString() {
244:                return name;
245:            }
246:
247:            /**
248:             * Constructor
249:             * @param parent The parent node
250:             * @param rrw The associated RemoteResourceWrapper
251:             * @param name The name of this node
252:             */
253:            protected RemoteResourceWrapperNode(
254:                    RemoteResourceWrapperNode parent,
255:                    RemoteResourceWrapper rrw, String name) {
256:                this .parent = parent;
257:                this .name = name;
258:                this .rrw = rrw;
259:
260:            }
261:
262:            /**
263:             * Constructor
264:             * @param rrw The associated RemoteResourceWrapper
265:             * @param name The name of this node
266:             */
267:            protected RemoteResourceWrapperNode(RemoteResourceWrapper rrw,
268:                    String name) {
269:                this.rrw = rrw;
270:                this.name = name;
271:            }
272:
273:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.