Source Code Cross Referenced for SchemaNodeFactory.java in  » IDE-Netbeans » xml » org » netbeans » modules » xml » schema » ui » 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.ui.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.ui.nodes;
043:
044:        import org.netbeans.modules.xml.schema.model.*;
045:        import org.netbeans.modules.xml.schema.ui.nodes.schema.*;
046:        import org.openide.nodes.Children;
047:        import org.openide.nodes.Node;
048:        import org.openide.util.Lookup;
049:
050:        /**
051:         *
052:         * @author  Todd Fast, todd.fast@sun.com
053:         */
054:        public abstract class SchemaNodeFactory extends Object {
055:
056:            /**
057:             *
058:             *
059:             */
060:            public SchemaNodeFactory(SchemaModel model, Lookup lookup) {
061:                super ();
062:                context = createContext(model, lookup);
063:            }
064:
065:            /**
066:             * Creates the SchemaUIContext.  Subclasses can override this method to
067:             * customize the SchemaUIContext instance.
068:             *
069:             */
070:            protected SchemaUIContext createContext(SchemaModel model,
071:                    Lookup lookup) {
072:                return new SchemaUIContext(model, this , lookup);
073:            }
074:
075:            /**
076:             * Returns the context object used by this factory.  All nodes created by
077:             * this factory will share this context object.
078:             *
079:             */
080:            public SchemaUIContext getContext() {
081:                return context;
082:            }
083:
084:            /**
085:             * Convenience method to create a "root" node for representing the schema.
086:             * This method is a convenience for calling <code>createNode()</code> and 
087:             * passing it a reference to the <code>Schema</code> component.
088:             *
089:             */
090:            public SchemaNode createRootNode() {
091:                //		SchemaComponentReference<Schema> reference=
092:                //			SchemaComponentReference.create(
093:                //				getContext().getModel().getSchema());
094:                return (SchemaNode) createNode(getContext().getModel()
095:                        .getSchema());
096:            }
097:
098:            ////////////////////////////////////////////////////////////////////////////
099:            // Primary factory methods
100:            ////////////////////////////////////////////////////////////////////////////
101:
102:            /**
103:             * Creates a node for the specified schema component
104:             *
105:             */
106:            public Node createNode(SchemaComponent component) {
107:                CreateSchemaComponentNodeVisitor cscnv = new CreateSchemaComponentNodeVisitor();
108:                return cscnv.createNode(this , component);
109:            }
110:
111:            /**
112:             * Create the node to represent the set of built-in simple types
113:             * (referred to as "primitive" types).
114:             *
115:             * @return  container node for the primitive simple types.
116:             */
117:            public abstract Node createPrimitiveTypesNode();
118:
119:            /**
120:             * Creates the children object for the specified component reference. The
121:             * defalut implementation returns <code>Children.LEAF</code>, meaning that
122:             * any nodes created via <code>createNode()</code> will be lead nodes with
123:             * no sub-structure.  Subclasses should override this method to return
124:             * more functional children objects.<p>
125:             *
126:             * Note, this method is only used by convention by methods in this class;
127:             * subclasses are free to create and use any children object in the 
128:             * various node factory methods.  This method provides a way to override
129:             * the default children created by this class, but its use by particular
130:             * node factory methods is not guaranteed.
131:             *
132:             * @param	parent
133:             *			The parent node of the about-to-be created node for which this
134:             *			method will return the children object.  Note, this node is
135:             *			<em>not</em> the node with which the return children object
136:             *			will be associated.
137:             * @param	reference
138:             *			The schema component reference associated with the about-to-be-
139:             *			created node.
140:             */
141:            public <C extends SchemaComponent> Children createChildren(
142:                    SchemaComponentReference<C> reference) {
143:                return Children.LEAF;
144:            }
145:
146:            ////////////////////////////////////////////////////////////////////////////
147:            // Node factory methods
148:            ////////////////////////////////////////////////////////////////////////////
149:
150:            /**
151:             *
152:             *
153:             */
154:            protected Node createAllNode(SchemaComponentReference<All> reference) {
155:                Children children = createChildren(reference);
156:                return new AllNode(getContext(), reference, children);
157:            }
158:
159:            /**
160:             *
161:             *
162:             */
163:            protected Node createAnnotationNode(
164:                    SchemaComponentReference<Annotation> reference) {
165:                Children children = createChildren(reference);
166:                return new AnnotationNode(getContext(), reference, children);
167:            }
168:
169:            /**
170:             *
171:             *
172:             */
173:            protected Node createAnyNode(
174:                    SchemaComponentReference<AnyElement> reference) {
175:                Children children = createChildren(reference);
176:                return new AnyNode(getContext(), reference, children);
177:            }
178:
179:            /**
180:             *
181:             *
182:             */
183:            protected Node createAnyAttributeNode(
184:                    SchemaComponentReference<AnyAttribute> reference) {
185:                Children children = createChildren(reference);
186:                return new AnyAttributeNode(getContext(), reference, children);
187:            }
188:
189:            /**
190:             *
191:             *
192:             */
193:            protected Node createAttributeGroupReferenceNode(
194:                    SchemaComponentReference<AttributeGroupReference> reference) {
195:                Children children = createChildren(reference);
196:                return new AttributeGroupReferenceNode(getContext(), reference,
197:                        children);
198:            }
199:
200:            /**
201:             *
202:             *
203:             */
204:            protected Node createChoiceNode(
205:                    SchemaComponentReference<Choice> reference) {
206:                Children children = createChildren(reference);
207:                return new ChoiceNode(getContext(), reference, children);
208:            }
209:
210:            /**
211:             *
212:             *
213:             */
214:            protected Node createComplexContentNode(
215:                    SchemaComponentReference<ComplexContent> reference) {
216:                Children children = createChildren(reference);
217:                return new ComplexContentNode(getContext(), reference, children);
218:            }
219:
220:            /**
221:             *
222:             *
223:             */
224:            protected Node createComplexContentRestrictionNode(
225:                    SchemaComponentReference<ComplexContentRestriction> reference) {
226:                Children children = createChildren(reference);
227:                return new ComplexContentRestrictionNode(getContext(),
228:                        reference, children);
229:            }
230:
231:            /**
232:             *
233:             *
234:             */
235:            protected Node createComplexExtensionNode(
236:                    SchemaComponentReference<ComplexExtension> reference) {
237:                Children children = createChildren(reference);
238:                return new ComplexExtensionNode(getContext(), reference,
239:                        children);
240:            }
241:
242:            /**
243:             *
244:             *
245:             */
246:            protected Node createDocumentationNode(
247:                    SchemaComponentReference<Documentation> reference) {
248:                Children children = createChildren(reference);
249:                return new DocumentationNode(getContext(), reference, children);
250:            }
251:
252:            /**
253:             *
254:             *
255:             */
256:            protected Node createAppInfoNode(
257:                    SchemaComponentReference<AppInfo> reference) {
258:                Children children = createChildren(reference);
259:                return new AppInfoNode(getContext(), reference, children);
260:            }
261:
262:            /**
263:             *
264:             *
265:             */
266:            protected Node createEnumerationNode(
267:                    SchemaComponentReference<Enumeration> reference) {
268:                Children children = createChildren(reference);
269:                return new EnumerationNode(getContext(), reference, children);
270:            }
271:
272:            /**
273:             *
274:             *
275:             */
276:            protected Node createFieldNode(
277:                    SchemaComponentReference<Field> reference) {
278:                Children children = createChildren(reference);
279:                return new FieldNode(getContext(), reference, children);
280:            }
281:
282:            /**
283:             *
284:             *
285:             */
286:            protected Node createFractionDigitsNode(
287:                    SchemaComponentReference<FractionDigits> reference) {
288:                Children children = createChildren(reference);
289:                return new FractionDigitsNode(getContext(), reference, children);
290:            }
291:
292:            /**
293:             *
294:             *
295:             */
296:            protected Node createGlobalAttributeNode(
297:                    SchemaComponentReference<GlobalAttribute> reference) {
298:                Children children = createChildren(reference);
299:                return new GlobalAttributeNode(getContext(), reference,
300:                        children);
301:            }
302:
303:            /**
304:             *
305:             *
306:             */
307:            protected Node createGlobalAttributeGroupNode(
308:                    SchemaComponentReference<GlobalAttributeGroup> reference) {
309:                Children children = createChildren(reference);
310:                return new GlobalAttributeGroupNode(getContext(), reference,
311:                        children);
312:            }
313:
314:            /**
315:             *
316:             *
317:             */
318:            protected Node createGlobalComplexTypeNode(
319:                    SchemaComponentReference<GlobalComplexType> reference) {
320:                Children children = createChildren(reference);
321:                return new GlobalComplexTypeNode(getContext(), reference,
322:                        children);
323:            }
324:
325:            /**
326:             *
327:             *
328:             */
329:            protected Node createGlobalElementNode(
330:                    SchemaComponentReference<GlobalElement> reference) {
331:                Children children = createChildren(reference);
332:                return new GlobalElementNode(getContext(), reference, children);
333:            }
334:
335:            /**
336:             *
337:             *
338:             */
339:            protected Node createGlobalGroupNode(
340:                    SchemaComponentReference<GlobalGroup> reference) {
341:                Children children = createChildren(reference);
342:                return new GlobalGroupNode(getContext(), reference, children);
343:            }
344:
345:            /**
346:             *
347:             *
348:             */
349:            protected Node createGlobalSimpleTypeNode(
350:                    SchemaComponentReference<GlobalSimpleType> reference) {
351:                Children children = createChildren(reference);
352:                return new GlobalSimpleTypeNode(getContext(), reference,
353:                        children);
354:            }
355:
356:            /**
357:             *
358:             *
359:             */
360:            protected Node createGroupReferenceNode(
361:                    SchemaComponentReference<GroupReference> reference) {
362:                Children children = createChildren(reference);
363:                return new GroupReferenceNode(getContext(), reference, children);
364:            }
365:
366:            /**
367:             *
368:             *
369:             */
370:            protected Node createImportNode(
371:                    SchemaComponentReference<Import> reference) {
372:                Children children = createChildren(reference);
373:                return new ImportNode(getContext(), reference, children);
374:            }
375:
376:            /**
377:             *
378:             *
379:             */
380:            protected Node createIncludeNode(
381:                    SchemaComponentReference<Include> reference) {
382:                Children children = createChildren(reference);
383:                return new IncludeNode(getContext(), reference, children);
384:            }
385:
386:            /**
387:             *
388:             *
389:             */
390:            protected Node createKeyNode(SchemaComponentReference<Key> reference) {
391:                Children children = createChildren(reference);
392:                return new KeyNode(getContext(), reference, children);
393:            }
394:
395:            /**
396:             *
397:             *
398:             */
399:            protected Node createKeyRefNode(
400:                    SchemaComponentReference<KeyRef> reference) {
401:                Children children = createChildren(reference);
402:                return new KeyRefNode(getContext(), reference, children);
403:            }
404:
405:            /**
406:             *
407:             *
408:             */
409:            protected Node createLengthNode(
410:                    SchemaComponentReference<Length> reference) {
411:                Children children = createChildren(reference);
412:                return new LengthNode(getContext(), reference, children);
413:            }
414:
415:            /**
416:             *
417:             *
418:             */
419:            protected Node createListNode(
420:                    SchemaComponentReference<List> reference) {
421:                Children children = createChildren(reference);
422:                return new ListNode(getContext(), reference, children);
423:            }
424:
425:            /**
426:             *
427:             *
428:             */
429:            protected Node createLocalAttributeNode(
430:                    SchemaComponentReference<LocalAttribute> reference) {
431:                Children children = createChildren(reference);
432:                return new LocalAttributeNode(getContext(), reference, children);
433:            }
434:
435:            /**
436:             *
437:             *
438:             */
439:            protected Node createAttributeReferenceNode(
440:                    SchemaComponentReference<AttributeReference> reference) {
441:                Children children = createChildren(reference);
442:                return new AttributeReferenceNode(getContext(), reference,
443:                        children);
444:            }
445:
446:            /**
447:             *
448:             *
449:             */
450:            protected Node createLocalComplexTypeNode(
451:                    SchemaComponentReference<LocalComplexType> reference) {
452:                Children children = createChildren(reference);
453:                return new LocalComplexTypeNode(getContext(), reference,
454:                        children);
455:            }
456:
457:            /**
458:             *
459:             *
460:             */
461:            protected Node createLocalElementNode(
462:                    SchemaComponentReference<LocalElement> reference) {
463:                Children children = createChildren(reference);
464:                return new LocalElementNode(getContext(), reference, children);
465:            }
466:
467:            /**
468:             *
469:             *
470:             */
471:            protected Node createElementReferenceNode(
472:                    SchemaComponentReference<ElementReference> reference) {
473:                Children children = createChildren(reference);
474:                return new ElementReferenceNode(getContext(), reference,
475:                        children);
476:            }
477:
478:            /**
479:             *
480:             *
481:             */
482:            protected Node createLocalSimpleTypeNode(
483:                    SchemaComponentReference<LocalSimpleType> reference) {
484:                Children children = createChildren(reference);
485:                return new LocalSimpleTypeNode(getContext(), reference,
486:                        children);
487:            }
488:
489:            /**
490:             *
491:             *
492:             */
493:            protected Node createMaxExclusiveNode(
494:                    SchemaComponentReference<MaxExclusive> reference) {
495:                Children children = createChildren(reference);
496:                return new MaxExclusiveNode(getContext(), reference, children);
497:            }
498:
499:            /**
500:             *
501:             *
502:             */
503:            protected Node createMaxInclusiveNode(
504:                    SchemaComponentReference<MaxInclusive> reference) {
505:                Children children = createChildren(reference);
506:                return new MaxInclusiveNode(getContext(), reference, children);
507:            }
508:
509:            /**
510:             *
511:             *
512:             */
513:            protected Node createMaxLengthNode(
514:                    SchemaComponentReference<MaxLength> reference) {
515:                Children children = createChildren(reference);
516:                return new MaxLengthNode(getContext(), reference, children);
517:            }
518:
519:            /**
520:             *
521:             *
522:             */
523:            protected Node createMinInclusiveNode(
524:                    SchemaComponentReference<MinInclusive> reference) {
525:                Children children = createChildren(reference);
526:                return new MinInclusiveNode(getContext(), reference, children);
527:            }
528:
529:            /**
530:             *
531:             *
532:             */
533:            protected Node createMinExclusiveNode(
534:                    SchemaComponentReference<MinExclusive> reference) {
535:                Children children = createChildren(reference);
536:                return new MinExclusiveNode(getContext(), reference, children);
537:            }
538:
539:            /**
540:             *
541:             *
542:             */
543:            protected Node createMinLengthNode(
544:                    SchemaComponentReference<MinLength> reference) {
545:                Children children = createChildren(reference);
546:                return new MinLengthNode(getContext(), reference, children);
547:            }
548:
549:            /**
550:             *
551:             *
552:             */
553:            protected Node createNotationNode(
554:                    SchemaComponentReference<Notation> reference) {
555:                Children children = createChildren(reference);
556:                return new NotationNode(getContext(), reference, children);
557:            }
558:
559:            /**
560:             *
561:             *
562:             */
563:            protected Node createPatternNode(
564:                    SchemaComponentReference<Pattern> reference) {
565:                Children children = createChildren(reference);
566:                return new PatternNode(getContext(), reference, children);
567:            }
568:
569:            /**
570:             *
571:             *
572:             */
573:            protected Node createRedefineNode(
574:                    SchemaComponentReference<Redefine> reference) {
575:                Children children = createChildren(reference);
576:                return new RedefineNode(getContext(), reference, children);
577:            }
578:
579:            /**
580:             *
581:             *
582:             */
583:            protected Node createSchemaNode(
584:                    SchemaComponentReference<Schema> reference) {
585:                Children children = createChildren(reference);
586:                return new SchemaNode(getContext(), reference, children);
587:            }
588:
589:            /**
590:             *
591:             *
592:             */
593:            protected Node createSequenceNode(
594:                    SchemaComponentReference<Sequence> reference) {
595:                Children children = createChildren(reference);
596:                return new SequenceNode(getContext(), reference, children);
597:            }
598:
599:            /**
600:             *
601:             *
602:             */
603:            protected Node createSelectorNode(
604:                    SchemaComponentReference<Selector> reference) {
605:                Children children = createChildren(reference);
606:                return new SelectorNode(getContext(), reference, children);
607:            }
608:
609:            /**
610:             *
611:             *
612:             */
613:            protected Node createSimpleContentNode(
614:                    SchemaComponentReference<SimpleContent> reference) {
615:                Children children = createChildren(reference);
616:                return new SimpleContentNode(getContext(), reference, children);
617:            }
618:
619:            /**
620:             *
621:             *
622:             */
623:            protected Node createSimpleContentRestrictionNode(
624:                    SchemaComponentReference<SimpleContentRestriction> reference) {
625:                Children children = createChildren(reference);
626:                return new SimpleContentRestrictionNode(getContext(),
627:                        reference, children);
628:            }
629:
630:            /**
631:             *
632:             *
633:             */
634:            protected Node createSimpleExtensionNode(
635:                    SchemaComponentReference<SimpleExtension> reference) {
636:                Children children = createChildren(reference);
637:                return new SimpleExtensionNode(getContext(), reference,
638:                        children);
639:            }
640:
641:            /**
642:             *
643:             *
644:             */
645:            protected Node createSimpleTypeRestrictionNode(
646:                    SchemaComponentReference<SimpleTypeRestriction> reference) {
647:                Children children = createChildren(reference);
648:                return new SimpleTypeRestrictionNode(getContext(), reference,
649:                        children);
650:            }
651:
652:            /**
653:             *
654:             *
655:             */
656:            protected Node createTotalDigitsNode(
657:                    SchemaComponentReference<TotalDigits> reference) {
658:                Children children = createChildren(reference);
659:                return new TotalDigitsNode(getContext(), reference, children);
660:            }
661:
662:            /**
663:             *
664:             *
665:             */
666:            protected Node createUnionNode(
667:                    SchemaComponentReference<Union> reference) {
668:                Children children = createChildren(reference);
669:                return new UnionNode(getContext(), reference, children);
670:            }
671:
672:            /**
673:             *
674:             *
675:             */
676:            protected Node createUniqueNode(
677:                    SchemaComponentReference<Unique> reference) {
678:                Children children = createChildren(reference);
679:                return new UniqueNode(getContext(), reference, children);
680:            }
681:
682:            /**
683:             *
684:             *
685:             */
686:            protected Node createWhitespaceNode(
687:                    SchemaComponentReference<Whitespace> reference) {
688:                Children children = createChildren(reference);
689:                return new WhitespaceNode(getContext(), reference, children);
690:            }
691:
692:            ////////////////////////////////////////////////////////////////////////////
693:            // Instance members
694:            ////////////////////////////////////////////////////////////////////////////
695:
696:            private SchemaUIContext context;
697:        }
w___w___w__.__j_a__v_a___2s__.c__om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.