KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > model > impl > GlobalAttributeGroupImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.schema.model.impl;
21 import java.util.ArrayList JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.Collections JavaDoc;
24 import java.util.List JavaDoc;
25 import org.netbeans.modules.xml.schema.model.*;
26 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor;
27 import org.w3c.dom.Element JavaDoc;
28
29 /**
30  * TODO implement
31  * @author Chris Webster
32  */

33 public class GlobalAttributeGroupImpl extends NamedImpl
34     implements GlobalAttributeGroup {
35
36      public GlobalAttributeGroupImpl(SchemaModelImpl model) {
37         this(model,createNewComponent(SchemaElements.ATTRIBUTE_GROUP,model));
38     }
39     
40     public GlobalAttributeGroupImpl(SchemaModelImpl model, Element JavaDoc e) {
41         super(model,e);
42     }
43
44     /**
45      *
46      *
47      */

48     public Class JavaDoc<? extends SchemaComponent> getComponentType() {
49         return GlobalAttributeGroup.class;
50     }
51
52     public void accept(SchemaVisitor v) {
53         v.visit(this);
54     }
55
56     /**
57      *
58      */

59     public void removeLocalAttribute(LocalAttribute attr) {
60         removeChild(LOCAL_ATTRIBUTE_PROPERTY, attr);
61     }
62
63     /**
64      *
65      */

66     public void addLocalAttribute(LocalAttribute attr) {
67         List JavaDoc<Class JavaDoc<? extends SchemaComponent>> list = new ArrayList JavaDoc<Class JavaDoc<? extends SchemaComponent>>();
68         list.add(AnyAttribute.class);
69         addBefore(LOCAL_ATTRIBUTE_PROPERTY, attr, list);
70     }
71     
72      /**
73      *
74      */

75     public void removeAttributeReference(AttributeReference attr) {
76         removeChild(LOCAL_ATTRIBUTE_PROPERTY, attr);
77     }
78
79     /**
80      *
81      */

82     public void addAttributeReference(AttributeReference attr) {
83         List JavaDoc<Class JavaDoc<? extends SchemaComponent>> list = new ArrayList JavaDoc<Class JavaDoc<? extends SchemaComponent>>();
84         list.add(AnyAttribute.class);
85         addBefore(LOCAL_ATTRIBUTE_PROPERTY, attr, list);
86     }
87
88     /**
89      *
90      */

91     public void setAnyAttribute(AnyAttribute attr) {
92         List JavaDoc<Class JavaDoc<? extends SchemaComponent>> list = Collections.emptyList();
93         setChild(AnyAttribute.class, ANY_ATTRIBUTE_PROPERTY, attr, list);
94     }
95     
96     /**
97      *
98      */

99     public void removeAttributeGroupReference(AttributeGroupReference ref) {
100         removeChild(ATTRIBUTE_GROUP_REFERENCE_PROPERTY, ref);
101     }
102
103     /**
104      *
105      */

106     public void addAttributeGroupReference(AttributeGroupReference ref) {
107         List JavaDoc<Class JavaDoc<? extends SchemaComponent>> list = new ArrayList JavaDoc<Class JavaDoc<? extends SchemaComponent>>();
108         list.add(AnyAttribute.class);
109         addBefore(ATTRIBUTE_GROUP_REFERENCE_PROPERTY, ref, list);
110     }
111
112     /**
113      *
114      */

115     public Collection JavaDoc<AttributeGroupReference> getAttributeGroupReferences() {
116         return getChildren(AttributeGroupReference.class);
117     }
118     
119     /**
120      *
121      */

122     public Collection JavaDoc<LocalAttribute> getLocalAttributes() {
123         return getChildren(LocalAttribute.class);
124     }
125     
126     /**
127      *
128      */

129     public Collection JavaDoc<AttributeReference> getAttributeReferences() {
130         return getChildren(AttributeReference.class);
131     }
132     
133     /**
134      *
135      */

136     public AnyAttribute getAnyAttribute() {
137         List JavaDoc<AnyAttribute> anyAttr = getChildren(AnyAttribute.class);
138         return anyAttr.isEmpty() ? null : anyAttr.get(0);
139     }
140 }
141
Popular Tags