1 19 package org.netbeans.modules.xml.axi; 20 21 import java.util.List ; 22 import java.util.Set ; 23 import org.netbeans.modules.xml.axi.impl.AXIModelBuilder; 24 import org.netbeans.modules.xml.axi.impl.Util; 25 import org.netbeans.modules.xml.axi.visitor.AXIVisitor; 26 import org.netbeans.modules.xml.schema.model.Form; 27 import org.netbeans.modules.xml.schema.model.GlobalElement; 28 import org.netbeans.modules.xml.schema.model.Schema; 29 import org.netbeans.modules.xml.schema.model.SchemaComponent; 30 31 36 public abstract class AXIDocument extends AXIComponent { 37 38 41 public AXIDocument(AXIModel model) { 42 super(model); 43 } 44 45 48 public AXIDocument(AXIModel model, SchemaComponent schemaComponent) { 49 super(model, schemaComponent); 50 } 51 52 55 public void accept(AXIVisitor visitor) { 56 visitor.visit(this); 57 } 58 59 62 public List <Element> getElements() { 63 return getChildren(Element.class); 64 } 65 66 69 public List <Attribute> getAttributes() { 70 return getChildren(Attribute.class); 71 } 72 73 76 public List <ContentModel> getContentModels() { 77 return getChildren(ContentModel.class); 78 } 79 80 81 84 public void addContentModel(ContentModel contentModel) { 85 appendChild(ContentModel.PROP_CONTENT_MODEL, contentModel); 86 } 87 88 91 public void removeContentModel(ContentModel contentModel) { 92 removeChild(ContentModel.PROP_CONTENT_MODEL, contentModel); 93 } 94 95 98 public void addElement(Element element) { 99 appendChild(Element.PROP_ELEMENT, element); 100 } 101 102 105 public void removeElement(Element element) { 106 removeChild(Element.PROP_ELEMENT, element); 107 } 108 109 112 public String getTargetNamespace() { 113 return namespace; 114 } 115 116 119 public void setTargetNamespace(String value) { 120 String oldValue = getTargetNamespace(); 121 if( (oldValue == null && value == null) || 122 (oldValue != null && oldValue.equals(value)) ) { 123 return; 124 } 125 this.namespace = value; 126 firePropertyChangeEvent(PROP_TARGET_NAMESPACE, oldValue, value); 127 } 128 129 public void setVersion(String value) { 130 String oldValue = getVersion(); 131 if( (oldValue == null && value == null) || 132 (oldValue != null && oldValue.equals(value)) ) { 133 return; 134 } 135 this.version = value; 136 firePropertyChangeEvent(PROP_VERSION, oldValue, value); 137 } 138 139 public String getVersion() { 140 return version; 141 } 142 143 public void setLanguage(String value) { 144 String oldValue = getLanguage(); 145 if( (oldValue == null && value == null) || 146 (oldValue != null && oldValue.equals(value)) ) { 147 return; 148 } 149 this.language = value; 150 firePropertyChangeEvent(PROP_LANGUAGE, oldValue, value); 151 } 152 153 public String getLanguage() { 154 return language; 155 } 156 157 172 public void setElementFormDefault(Form value) { 173 Form oldValue = getElementFormDefault(); 174 if( (oldValue == null && value == null) || 175 (oldValue != null && oldValue.equals(value)) ) { 176 return; 177 } 178 this.elementFormDefault = value; 179 firePropertyChangeEvent(PROP_ELEMENT_FORM_DEFAULT, oldValue, value); 180 } 181 182 public Form getElementFormDefault() { 183 return elementFormDefault; 184 } 185 186 public void setAttributeFormDefault(Form value) { 187 Form oldValue = getAttributeFormDefault(); 188 if( (oldValue == null && value == null) || 189 (oldValue != null && oldValue.equals(value)) ) { 190 return; 191 } 192 this.attributeFormDefault = value; 193 firePropertyChangeEvent(PROP_ATTRIBUTE_FORM_DEFAULT, oldValue, value); 194 } 195 196 public Form getAttributeFormDefault() { 197 return attributeFormDefault; 198 } 199 200 public void setSchemaDesignPattern(SchemaGenerator.Pattern value) { 201 SchemaGenerator.Pattern oldValue = getSchemaDesignPattern(); 202 if( (oldValue == null && value == null) || 203 (oldValue != null && oldValue == value) ) { 204 return; 205 } 206 if(getModel() != null) 207 getModel().setSchemaDesignPattern(value); 208 firePropertyChangeEvent(PROP_SCHEMA_DESIGN_PATTERN, oldValue, value); 209 } 210 211 public SchemaGenerator.Pattern getSchemaDesignPattern() { 212 return getModel()!=null?getModel().getSchemaDesignPattern():null; 213 } 214 215 private String namespace; 216 private String version; 217 private String language; 218 private Form attributeFormDefault; 219 private Form elementFormDefault; 220 221 public static final String PROP_TARGET_NAMESPACE = "targetNamespace"; public static final String PROP_LANGUAGE = "language"; public static final String PROP_VERSION = "version"; public static final String PROP_ATTRIBUTE_FORM_DEFAULT = "attributeFormDefault"; public static final String PROP_ELEMENT_FORM_DEFAULT = "elementFormDefault"; public static final String PROP_SCHEMA_DESIGN_PATTERN = "schemaDesignPattern"; } 228 | Popular Tags |