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-2006 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.model.impl;
043:
044: import org.netbeans.modules.xml.schema.model.*;
045: import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
046: import org.netbeans.modules.xml.xam.NamedReferenceable;
047:
048: /**
049: *
050: * @author rico
051: * @author Chris Webster
052: */
053: public class SchemaComponentFactoryImpl implements
054: SchemaComponentFactory {
055:
056: private SchemaModelImpl model;
057:
058: /**
059: * Creates a new instance of SchemaComponentFactoryImpl
060: */
061: public SchemaComponentFactoryImpl(SchemaModelImpl model) {
062: this .model = model;
063: }
064:
065: /**
066: *
067: *
068: * @param currentElement to create model object from
069: * @param parent containing this element
070: * @return instance of model object for the given element.
071: */
072: public SchemaComponent create(org.w3c.dom.Element currentElement,
073: SchemaComponent parent) {
074: SchemaElementNodeVisitor v = new SchemaElementNodeVisitor();
075: return v.createSubComponent(parent, currentElement, model);
076: }
077:
078: public Whitespace createWhitespace() {
079: return new WhitespaceImpl(model);
080: }
081:
082: public Unique createUnique() {
083: return new UniqueImpl(model);
084: }
085:
086: public Union createUnion() {
087: return new UnionImpl(model);
088: }
089:
090: public TotalDigits createTotalDigits() {
091: return new TotalDigitsImpl(model);
092: }
093:
094: public GroupReference createGroupReference() {
095: return new GroupReferenceImpl(model);
096: }
097:
098: public GlobalGroup createGroupDefinition() {
099: return new GlobalGroupImpl(model);
100: }
101:
102: public GlobalSimpleType createGlobalSimpleType() {
103: return new GlobalSimpleTypeImpl(model);
104: }
105:
106: public GlobalElement createGlobalElement() {
107: return new GlobalElementImpl(model);
108: }
109:
110: public GlobalComplexType createGlobalComplexType() {
111: return new GlobalComplexTypeImpl(model);
112: }
113:
114: public GlobalAttributeGroup createGlobalAttributeGroup() {
115: return new GlobalAttributeGroupImpl(model);
116: }
117:
118: public GlobalAttribute createGlobalAttribute() {
119: return new GlobalAttributeImpl(model);
120: }
121:
122: public FractionDigits createFractionDigits() {
123: return new FractionDigitsImpl(model);
124: }
125:
126: public Field createField() {
127: return new FieldImpl(model);
128: }
129:
130: public All createAll() {
131: return new AllImpl(model);
132: }
133:
134: public Annotation createAnnotation() {
135: return new AnnotationImpl(model);
136: }
137:
138: public AnyElement createAny() {
139: return new AnyImpl(model);
140: }
141:
142: public AnyAttribute createAnyAttribute() {
143: return new AnyAttributeImpl(model);
144: }
145:
146: public AttributeGroupReference createAttributeGroupReference() {
147: return new AttributeGroupReferenceImpl(model);
148: }
149:
150: public Choice createChoice() {
151: return new ChoiceImpl(model);
152: }
153:
154: public ComplexContent createComplexContent() {
155: return new ComplexContentImpl(model);
156: }
157:
158: public ComplexContentRestriction createComplexContentRestriction() {
159: return new ComplexContentRestrictionImpl(model);
160: }
161:
162: public ComplexExtension createComplexExtension() {
163: return new ComplexExtensionImpl(model);
164: }
165:
166: public Documentation createDocumentation() {
167: return new DocumentationImpl(model);
168: }
169:
170: public Enumeration createEnumeration() {
171: return new EnumerationImpl(model);
172: }
173:
174: public Import createImport() {
175: return new ImportImpl(model);
176: }
177:
178: public Include createInclude() {
179: return new IncludeImpl(model);
180: }
181:
182: public Key createKey() {
183: return new KeyImpl(model);
184: }
185:
186: public KeyRef createKeyRef() {
187: return new KeyRefImpl(model);
188: }
189:
190: public Length createLength() {
191: return new LengthImpl(model);
192: }
193:
194: public List createList() {
195: return new ListImpl(model);
196: }
197:
198: public LocalAttribute createLocalAttribute() {
199: return new LocalAttributeImpl(model);
200: }
201:
202: public LocalComplexType createLocalComplexType() {
203: return new LocalComplexTypeImpl(model);
204: }
205:
206: public LocalElement createLocalElement() {
207: return new LocalElementImpl(model);
208: }
209:
210: public LocalSimpleType createLocalSimpleType() {
211: return new LocalSimpleTypeImpl(model);
212: }
213:
214: public MaxExclusive createMaxExclusive() {
215: return new MaxExclusiveImpl(model);
216: }
217:
218: public MaxInclusive createMaxInclusive() {
219: return new MaxInclusiveImpl(model);
220: }
221:
222: public MaxLength createMaxLength() {
223: return new MaxLengthImpl(model);
224: }
225:
226: public MinExclusive createMinExclusive() {
227: return new MinExclusiveImpl(model);
228: }
229:
230: public MinInclusive createMinInclusive() {
231: return new MinInclusiveImpl(model);
232: }
233:
234: public MinLength createMinLength() {
235: return new MinLengthImpl(model);
236: }
237:
238: public Pattern createPattern() {
239: return new PatternImpl(model);
240: }
241:
242: public Redefine createRedefine() {
243: return new RedefineImpl(model);
244: }
245:
246: public Schema createSchema() {
247: return new SchemaImpl(model);
248: }
249:
250: public Selector createSelector() {
251: return new SelectorImpl(model);
252: }
253:
254: public Sequence createSequence() {
255: return new SequenceImpl(model);
256: }
257:
258: public SimpleContent createSimpleContent() {
259: return new SimpleContentImpl(model);
260: }
261:
262: public SimpleContentRestriction createSimpleContentRestriction() {
263: return new SimpleContentRestrictionImpl(model);
264: }
265:
266: public SimpleExtension createSimpleExtension() {
267: return new SimpleExtensionImpl(model);
268: }
269:
270: public SimpleTypeRestriction createSimpleTypeRestriction() {
271: return new SimpleTypeRestrictionImpl(model);
272: }
273:
274: public <T extends ReferenceableSchemaComponent> NamedComponentReference<T> createGlobalReference(
275: T type, Class<T> c, SchemaComponent parent) {
276: return new GlobalReferenceImpl<T>(type, c,
277: (SchemaComponentImpl) parent);
278: }
279:
280: public Notation createNotation() {
281: return new NotationImpl(model);
282: }
283:
284: public AppInfo createAppInfo() {
285: return new AppInfoImpl(model);
286: }
287:
288: public ElementReference createElementReference() {
289: return new ElementReferenceImpl(model);
290: }
291:
292: public AttributeReference createAttributeReference() {
293: return new AttributeReferenceImpl(model);
294: }
295:
296: }
|