1 19 20 package org.netbeans.modules.xml.schema.ui.nodes; 21 22 import java.util.*; 23 import org.netbeans.modules.xml.schema.model.SchemaComponent; 24 import org.netbeans.modules.xml.schema.model.SchemaComponentReference; 25 26 31 public class FilteredSchemaComponentNodeChildren<C extends SchemaComponent> 32 extends SchemaComponentNodeChildren<C> 33 { 34 38 public <T extends SchemaComponent> FilteredSchemaComponentNodeChildren( 39 SchemaUIContext context, SchemaComponentReference<C> reference, 40 Class <T> childType, Comparator<SchemaComponent> comparator) 41 { 42 super(context,reference); 43 this.childType=childType; 44 this.comparator=comparator; 45 } 46 47 48 52 public Class <? extends SchemaComponent> getChildType() 53 { 54 return childType; 55 } 56 57 58 62 public Comparator<SchemaComponent> getComparator() 63 { 64 return comparator; 65 } 66 67 68 72 @Override 73 public void refreshChildren() 74 { 75 C parentComponent=getReference().get(); 76 77 List<SchemaComponent> children=new java.util.ArrayList <SchemaComponent>( 78 parentComponent.getChildren(getChildType())); 79 80 if (getComparator()!=null) 89 Collections.sort(children,getComparator()); 90 91 setKeys(children); 92 } 93 94 95 96 97 101 private Class <? extends SchemaComponent> childType; 102 private Comparator<SchemaComponent> comparator; 103 } 104 | Popular Tags |