1 19 package org.netbeans.modules.xml.schema.model.impl; 20 21 import org.netbeans.modules.xml.schema.model.GlobalAttributeGroup; 22 import org.netbeans.modules.xml.schema.model.GlobalComplexType; 23 import org.netbeans.modules.xml.schema.model.GlobalSimpleType; 24 import org.netbeans.modules.xml.schema.model.GlobalGroup; 25 import org.netbeans.modules.xml.schema.model.Redefine; 26 import org.netbeans.modules.xml.schema.model.SchemaComponent; 27 import org.netbeans.modules.xml.schema.model.SchemaModel; 28 import org.netbeans.modules.xml.schema.model.SchemaModelFactory; 29 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor; 30 import org.netbeans.modules.xml.xam.Model; 31 import org.netbeans.modules.xml.xam.locator.CatalogModelException; 32 import org.netbeans.modules.xml.xam.ModelSource; 33 import org.openide.util.NbBundle; 34 import org.w3c.dom.Element ; 35 36 40 public class RedefineImpl extends SchemaComponentImpl implements Redefine { 41 42 public RedefineImpl(SchemaModelImpl model) { 43 this(model,createNewComponent(SchemaElements.REDEFINE,model)); 44 } 45 48 public RedefineImpl(SchemaModelImpl model, Element el) { 49 super(model, el); 50 } 51 52 56 public Class <? extends SchemaComponent> getComponentType() { 57 return Redefine.class; 58 } 59 60 63 public void setSchemaLocation(String uri) { 64 setAttribute(SCHEMA_LOCATION_PROPERTY, SchemaAttributes.SCHEMA_LOCATION, uri); 65 } 66 67 70 public void addComplexType(GlobalComplexType type) { 71 appendChild(COMPLEX_TYPE_PROPERTY, type); 72 } 73 74 77 public void removeComplexType(GlobalComplexType type) { 78 removeChild(COMPLEX_TYPE_PROPERTY, type); 79 } 80 81 84 public void addAttributeGroup(GlobalAttributeGroup group) { 85 appendChild(ATTRIBUTE_GROUP_PROPERTY, group); 86 } 87 88 91 public void removeAttributeGroup(GlobalAttributeGroup group) { 92 removeChild(ATTRIBUTE_GROUP_PROPERTY, group); 93 } 94 95 98 public void removeSimpleType(GlobalSimpleType type) { 99 removeChild(SIMPLE_TYPE_PROPERTY, type); 100 } 101 102 105 public void addSimpleType(GlobalSimpleType type) { 106 appendChild(SIMPLE_TYPE_PROPERTY, type); 107 } 108 109 112 public void accept(SchemaVisitor visitor) { 113 visitor.visit(this); 114 } 115 116 119 public void addGroupDefinition(GlobalGroup def) { 120 appendChild(GROUP_DEFINITION_PROPERTY, def); 121 } 122 123 126 public void removeGroupDefinition(GlobalGroup def) { 127 removeChild(GROUP_DEFINITION_PROPERTY, def); 128 } 129 130 133 public java.util.Collection <GlobalAttributeGroup> getAttributeGroups() { 134 return getChildren(GlobalAttributeGroup.class); 135 } 136 137 140 public java.util.Collection <GlobalComplexType> getComplexTypes() { 141 return getChildren(GlobalComplexType.class); 142 } 143 144 147 public java.util.Collection <GlobalGroup> getGroupDefinitions() { 148 return getChildren(GlobalGroup.class); 149 } 150 151 154 public String getSchemaLocation() { 155 return getAttribute(SchemaAttributes.SCHEMA_LOCATION); 156 } 157 158 161 public java.util.Collection <GlobalSimpleType> getSimpleTypes() { 162 return getChildren(GlobalSimpleType.class); 163 } 164 165 public SchemaModel resolveReferencedModel() throws CatalogModelException { 166 ModelSource ms = resolveModel(getSchemaLocation()); 167 return SchemaModelFactory.getDefault().getModel(ms); 168 } 169 } 170 | Popular Tags |