1 19 20 package org.netbeans.modules.xml.schema.ui.nodes.categorized; 21 22 import java.util.List ; 23 import org.netbeans.modules.xml.schema.model.All; 24 import org.netbeans.modules.xml.schema.model.Annotation; 25 import org.netbeans.modules.xml.schema.model.AttributeGroupReference; 26 import org.netbeans.modules.xml.schema.model.AttributeReference; 27 import org.netbeans.modules.xml.schema.model.Choice; 28 import org.netbeans.modules.xml.schema.model.ElementReference; 29 import org.netbeans.modules.xml.schema.model.Enumeration; 30 import org.netbeans.modules.xml.schema.model.GlobalAttribute; 31 import org.netbeans.modules.xml.schema.model.GlobalAttributeGroup; 32 import org.netbeans.modules.xml.schema.model.GlobalComplexType; 33 import org.netbeans.modules.xml.schema.model.GlobalElement; 34 import org.netbeans.modules.xml.schema.model.GlobalGroup; 35 import org.netbeans.modules.xml.schema.model.GlobalSimpleType; 36 import org.netbeans.modules.xml.schema.model.GroupReference; 37 import org.netbeans.modules.xml.schema.model.Import; 38 import org.netbeans.modules.xml.schema.model.Include; 39 import org.netbeans.modules.xml.schema.model.Key; 40 import org.netbeans.modules.xml.schema.model.KeyRef; 41 import org.netbeans.modules.xml.schema.model.LocalAttribute; 42 import org.netbeans.modules.xml.schema.model.LocalComplexType; 43 import org.netbeans.modules.xml.schema.model.LocalElement; 44 import org.netbeans.modules.xml.schema.model.LocalSimpleType; 45 import org.netbeans.modules.xml.schema.model.Redefine; 46 import org.netbeans.modules.xml.schema.model.Schema; 47 import org.netbeans.modules.xml.schema.model.SchemaComponent; 48 import org.netbeans.modules.xml.schema.model.SchemaComponentReference; 49 import org.netbeans.modules.xml.schema.model.SchemaModel; 50 import org.netbeans.modules.xml.schema.model.Sequence; 51 import org.netbeans.modules.xml.schema.model.Unique; 52 import org.netbeans.modules.xml.schema.ui.nodes.SchemaNodeFactory; 53 import org.openide.nodes.Children; 54 import org.openide.nodes.Node; 55 import org.openide.util.Lookup; 56 57 64 public class CategorizedSchemaNodeFactory extends SchemaNodeFactory 65 { 66 70 public CategorizedSchemaNodeFactory(SchemaModel model, Lookup lookup) 71 { 72 this(model,null,lookup); 73 } 74 75 76 83 public CategorizedSchemaNodeFactory(SchemaModel model, 84 List <Class <? extends SchemaComponent>> filters, Lookup lookup) 85 { 86 super(model,lookup); 87 this.filters=filters; 88 } 89 90 91 95 public List <Class <? extends SchemaComponent>> getChildFilters() 96 { 97 return filters; 98 } 99 100 101 105 @Override 106 public <C extends SchemaComponent> Children createChildren( 107 SchemaComponentReference<C> reference) 108 { 109 return new CategorizedChildren<C>(getContext(),reference, 110 getChildFilters()); 111 } 112 113 114 public Node createPrimitiveTypesNode() { 115 return new PrimitiveSimpleTypesNode(getContext()); 116 } 117 118 119 120 124 128 @Override 129 protected Node createAnnotationNode( 130 SchemaComponentReference<Annotation> reference) 131 { 132 Children children=new AnnotationChildren(getContext(), reference); 134 return new AdvancedAnnotationNode(getContext(),reference,children); 135 } 136 137 141 @Override 142 protected Node createAllNode( 143 SchemaComponentReference<All> reference) 144 { 145 Children children=createChildren(reference); 147 return new AdvancedAllNode(getContext(),reference,children); 148 } 149 150 151 155 protected Node createSequenceNode( 156 SchemaComponentReference<Sequence> reference) 157 { 158 Children children = new SequenceChildren<Sequence>( 159 getContext(), reference); 160 return new AdvancedSequenceNode(getContext(), reference, 161 children); 162 } 163 164 165 169 protected Node createChoiceNode( 170 SchemaComponentReference<Choice> reference) 171 { 172 Children children=createChildren(reference); 173 return new AdvancedChoiceNode(getContext(),reference,children); 174 } 175 176 177 181 protected Node createGlobalAttributeGroupNode( 182 SchemaComponentReference<GlobalAttributeGroup> reference) 183 { 184 Children children=createChildren(reference); 185 return new AdvancedGlobalAttributeGroupNode( 186 getContext(),reference,children); 187 } 188 189 190 194 protected Node createGlobalGroupNode( 195 SchemaComponentReference<GlobalGroup> reference) 196 { 197 Children children=createChildren(reference); 198 return new AdvancedGlobalGroupNode( 199 getContext(),reference,children); 200 } 201 202 203 207 protected Node createGlobalAttributeNode( 208 SchemaComponentReference<GlobalAttribute> reference) 209 { 210 Children children=createChildren(reference); 211 return new AdvancedGlobalAttributeNode( 212 getContext(),reference,children); 213 } 214 215 216 220 protected Node createLocalAttributeNode( 221 SchemaComponentReference<LocalAttribute> reference) 222 { 223 Children children=createChildren(reference); 224 return new AdvancedLocalAttributeNode( 225 getContext(),reference,children); 226 } 227 228 229 233 @Override 234 protected Node createGlobalElementNode( 235 SchemaComponentReference<GlobalElement> reference) 236 { 237 Children children = new ElementChildren<GlobalElement> 238 (getContext(),reference); 239 AdvancedGlobalElementNode result= 240 new AdvancedGlobalElementNode(getContext(),reference,children); 241 return result; 242 } 243 244 245 249 @Override 250 protected Node createLocalElementNode( 251 SchemaComponentReference<LocalElement> reference) 252 { 253 Children children = new ElementChildren<LocalElement> 254 (getContext(),reference); 255 Node result= 256 new AdvancedLocalElementNode(getContext(),reference,children); 257 return result; 258 } 259 260 261 @Override 262 protected Node createElementReferenceNode( 263 SchemaComponentReference<ElementReference> reference) { 264 Children children = new ReferenceChildren<ElementReference> 265 (getContext(),reference); 266 Node result= 267 new AdvancedElementReferenceNode(getContext(),reference,children); 268 return result; 269 } 270 271 @Override 272 protected Node createAttributeGroupReferenceNode( 273 SchemaComponentReference<AttributeGroupReference> reference) { 274 Children children = new ReferenceChildren<AttributeGroupReference> 275 (getContext(),reference); 276 Node result= 277 new AdvancedAttributeGroupReferenceNode(getContext(),reference,children); 278 return result; 279 } 280 281 @Override 282 protected Node createGroupReferenceNode( 283 SchemaComponentReference<GroupReference> reference) { 284 Children children = new ReferenceChildren<GroupReference> 285 (getContext(),reference); 286 Node result= 287 new AdvancedGroupReferenceNode(getContext(),reference,children); 288 return result; 289 } 290 291 @Override 292 protected Node createAttributeReferenceNode( 293 SchemaComponentReference<AttributeReference> reference) { 294 Children children = new ReferenceChildren<AttributeReference> 295 (getContext(),reference); 296 Node result= 297 new AdvancedAttributeReferenceNode(getContext(),reference,children); 298 return result; 299 } 300 301 305 @Override 306 protected Node createGlobalComplexTypeNode( 307 SchemaComponentReference<GlobalComplexType> reference) 308 { 309 310 Children children = new ComplexTypeChildren<GlobalComplexType> 311 (getContext(),reference); 312 AdvancedGlobalComplexTypeNode result= 313 new AdvancedGlobalComplexTypeNode(getContext(),reference,children); 314 return result; 315 } 316 317 318 322 protected Node createLocalComplexTypeNode( 323 SchemaComponentReference<LocalComplexType> reference) 324 { 325 Children children = new ComplexTypeChildren<LocalComplexType> 326 (getContext(),reference); 327 return new AdvancedLocalComplexTypeNode( 328 getContext(),reference,children); 329 } 330 331 332 336 protected Node createGlobalSimpleTypeNode( 337 SchemaComponentReference<GlobalSimpleType> reference) 338 { 339 Children children = new SimpleTypeChildren<GlobalSimpleType> 340 (getContext(),reference); 341 return new AdvancedGlobalSimpleTypeNode( 342 getContext(),reference,children); 343 } 344 345 346 350 protected Node createLocalSimpleTypeNode( 351 SchemaComponentReference<LocalSimpleType> reference) 352 { 353 Children children = new SimpleTypeChildren<LocalSimpleType> 354 (getContext(),reference); 355 return new AdvancedLocalSimpleTypeNode( 356 getContext(),reference,children); 357 } 358 359 360 protected Node createEnumerationNode(SchemaComponentReference<Enumeration> reference) { 361 Children children = createChildren(reference); 362 return new AdvancedEnumerationNode(getContext(),reference,children); 363 } 364 365 369 protected Node createKeyNode( 370 SchemaComponentReference<Key> reference) 371 { 372 Children children = createChildren(reference); 373 return new AdvancedKeyNode(getContext(),reference,children); 374 } 375 376 377 381 protected Node createKeyRefNode( 382 SchemaComponentReference<KeyRef> reference) 383 { 384 Children children = createChildren(reference); 385 return new AdvancedKeyRefNode(getContext(),reference,children); 386 } 387 388 389 393 protected Node createUniqueNode( 394 SchemaComponentReference<Unique> reference) 395 { 396 Children children = createChildren(reference); 397 return new AdvancedUniqueNode(getContext(),reference,children); 398 } 399 400 401 405 protected Node createSchemaNode( 406 SchemaComponentReference<Schema> reference) 407 { 408 Children children=createChildren(reference); 409 return new AdvancedSchemaNode(getContext(),reference,children); 410 } 411 412 413 417 protected Node createImportNode( 418 SchemaComponentReference<Import> reference) 419 { 420 Children children = new ReferencedSchemaModelChildren<Import> 421 (getContext(),reference); 422 return new AdvancedImportNode(getContext(),reference,children); 423 } 424 425 426 430 protected Node createIncludeNode( 431 SchemaComponentReference<Include> reference) 432 { 433 Children children = new ReferencedSchemaModelChildren<Include> 434 (getContext(),reference); 435 return new AdvancedIncludeNode(getContext(),reference,children); 436 } 437 438 439 443 protected Node createRedefineNode( 444 SchemaComponentReference<Redefine> reference) 445 { 446 Children children = new ReferencedSchemaModelChildren<Redefine> 447 (getContext(),reference); 448 return new AdvancedRedefineNode(getContext(),reference,children); 449 } 450 451 452 456 private List <Class <? extends SchemaComponent>> filters; 457 458 } 459 | Popular Tags |