1 19 20 package org.netbeans.modules.xml.schema.model.impl; 21 import java.util.ArrayList ; 22 import java.util.Collection ; 23 import java.util.Collections ; 24 import java.util.List ; 25 import org.netbeans.modules.xml.schema.model.*; 26 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor; 27 import org.w3c.dom.Element ; 28 29 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 e) { 41 super(model,e); 42 } 43 44 48 public Class <? extends SchemaComponent> getComponentType() { 49 return GlobalAttributeGroup.class; 50 } 51 52 public void accept(SchemaVisitor v) { 53 v.visit(this); 54 } 55 56 59 public void removeLocalAttribute(LocalAttribute attr) { 60 removeChild(LOCAL_ATTRIBUTE_PROPERTY, attr); 61 } 62 63 66 public void addLocalAttribute(LocalAttribute attr) { 67 List <Class <? extends SchemaComponent>> list = new ArrayList <Class <? extends SchemaComponent>>(); 68 list.add(AnyAttribute.class); 69 addBefore(LOCAL_ATTRIBUTE_PROPERTY, attr, list); 70 } 71 72 75 public void removeAttributeReference(AttributeReference attr) { 76 removeChild(LOCAL_ATTRIBUTE_PROPERTY, attr); 77 } 78 79 82 public void addAttributeReference(AttributeReference attr) { 83 List <Class <? extends SchemaComponent>> list = new ArrayList <Class <? extends SchemaComponent>>(); 84 list.add(AnyAttribute.class); 85 addBefore(LOCAL_ATTRIBUTE_PROPERTY, attr, list); 86 } 87 88 91 public void setAnyAttribute(AnyAttribute attr) { 92 List <Class <? extends SchemaComponent>> list = Collections.emptyList(); 93 setChild(AnyAttribute.class, ANY_ATTRIBUTE_PROPERTY, attr, list); 94 } 95 96 99 public void removeAttributeGroupReference(AttributeGroupReference ref) { 100 removeChild(ATTRIBUTE_GROUP_REFERENCE_PROPERTY, ref); 101 } 102 103 106 public void addAttributeGroupReference(AttributeGroupReference ref) { 107 List <Class <? extends SchemaComponent>> list = new ArrayList <Class <? extends SchemaComponent>>(); 108 list.add(AnyAttribute.class); 109 addBefore(ATTRIBUTE_GROUP_REFERENCE_PROPERTY, ref, list); 110 } 111 112 115 public Collection <AttributeGroupReference> getAttributeGroupReferences() { 116 return getChildren(AttributeGroupReference.class); 117 } 118 119 122 public Collection <LocalAttribute> getLocalAttributes() { 123 return getChildren(LocalAttribute.class); 124 } 125 126 129 public Collection <AttributeReference> getAttributeReferences() { 130 return getChildren(AttributeReference.class); 131 } 132 133 136 public AnyAttribute getAnyAttribute() { 137 List <AnyAttribute> anyAttr = getChildren(AnyAttribute.class); 138 return anyAttr.isEmpty() ? null : anyAttr.get(0); 139 } 140 } 141 | Popular Tags |