Source Code Cross Referenced for ABENodeFactory.java in  » IDE-Netbeans » xml » org » netbeans » modules » xml » schema » abe » nodes » 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 » IDE Netbeans » xml » org.netbeans.modules.xml.schema.abe.nodes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.xml.schema.abe.nodes;
043:
044:        import java.util.ArrayList;
045:        import java.util.List;
046:        import org.netbeans.modules.xml.axi.AXIComponent;
047:        import org.netbeans.modules.xml.axi.AXIDocument;
048:        import org.netbeans.modules.xml.axi.AXIModel;
049:        import org.netbeans.modules.xml.axi.AbstractElement;
050:        import org.netbeans.modules.xml.axi.AnyElement;
051:        import org.netbeans.modules.xml.axi.Attribute;
052:        import org.netbeans.modules.xml.axi.ContentModel;
053:        import org.netbeans.modules.xml.axi.datatype.CustomDatatype;
054:        import org.netbeans.modules.xml.axi.datatype.Datatype;
055:        import org.openide.nodes.Children;
056:        import org.openide.nodes.Node;
057:        import org.openide.util.Lookup;
058:
059:        /**
060:         *
061:         * @author  Todd Fast, todd.fast@sun.com
062:         */
063:        public class ABENodeFactory<T extends AXIComponent> extends Object {
064:            /**
065:             *
066:             *
067:             */
068:            public ABENodeFactory(AXIModel model, Lookup lookup) {
069:                super ();
070:                context = createContext(model, lookup);
071:            }
072:
073:            /**
074:             * Creates the ABEUIContext.  Subclasses can override this method to
075:             * customize the ABEUIContext instance.
076:             */
077:            protected ABEUIContext createContext(AXIModel model, Lookup lookup) {
078:                return new ABEUIContext(model, this , lookup);
079:            }
080:
081:            /**
082:             * Returns the context object used by this factory.  All nodes created by
083:             * this factory will share this context object.
084:             *
085:             */
086:            public ABEUIContext getContext() {
087:                return context;
088:            }
089:
090:            /**
091:             * Convenience method to create a "root" node for representing the schema.
092:             * This method is a convenience for calling <code>createNode()</code> and 
093:             * passing it a reference to the <code>Schema</code> component.
094:             *
095:             */
096:            public Node createRootNode() {
097:                return createRootNode(null);
098:            }
099:
100:            /**
101:             * Convenience method to create a "root" node for representing the schema.
102:             * This method is a convenience for calling <code>createNode()</code> and 
103:             * passing it a reference to the <code>Schema</code> component.
104:             *
105:             */
106:            public Node createRootNode(List<Class> filterTypes) {
107:                return new CategorizedDocumentNode(context, context.getModel()
108:                        .getRoot(), filterTypes);
109:            }
110:
111:            ////////////////////////////////////////////////////////////////////////////
112:            // Primary factory methods
113:            ////////////////////////////////////////////////////////////////////////////
114:
115:            /**
116:             * Creates a node for the specified schema component
117:             *
118:             */
119:            public Node createNode(Node parent, AXIComponent component) {
120:                if (component instanceof  AnyElement)
121:                    return new AnyElementNode((AnyElement) component);
122:                else if (component instanceof  AbstractElement)
123:                    return new ElementNode((AbstractElement) component);
124:                else if (component instanceof  ContentModel)
125:                    return new ContentModelNode((ContentModel) component);
126:                else if (component instanceof  Attribute)
127:                    return new AttributeNode((Attribute) component);
128:                return null;
129:            }
130:
131:            /**
132:             * Creates a node for the specified schema component
133:             *
134:             */
135:            public Node createNode(Node parent, Datatype component) {
136:                if (component instanceof  CustomDatatype)
137:                    return new CustomDatatypeNode((CustomDatatype) component);
138:                else
139:                    return new DatatypeNode(component);
140:
141:            }
142:
143:            /**
144:             * Creates the children object for the specified component reference. The
145:             * defalut implementation returns <code>Children.LEAF</code>, meaning that
146:             * any nodes created via <code>createNode()</code> will be lead nodes with
147:             * no sub-structure.  Subclasses should override this method to return
148:             * more functional children objects.<p>
149:             *
150:             * Note, this method is only used by convention by methods in this class;
151:             * subclasses are free to create and use any children object in the 
152:             * various node factory methods.  This method provides a way to override
153:             * the default children created by this class, but its use by particular
154:             * node factory methods is not guaranteed.
155:             *
156:             * @param	parent
157:             *			The parent node of the about-to-be created node for which this
158:             *			method will return the children object.  Note, this node is
159:             *			<em>not</em> the node with which the return children object
160:             *			will be associated.
161:             * @param	reference
162:             *			The schema component reference associated with the about-to-be-
163:             *			created node.
164:             */
165:            public Children createChildren(Node parent, AXIComponent component) {
166:                return Children.LEAF;
167:            }
168:
169:            ////////////////////////////////////////////////////////////////////////////
170:            // Instance members
171:            ////////////////////////////////////////////////////////////////////////////
172:
173:            private ABEUIContext context;
174:        }
www.j___a_va___2s_._co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.