1 2 package org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel; 3 4 18 19 27 public class OjbMetaRootNode extends OjbMetaTreeNode 28 { 29 private java.util.ArrayList supportedActions = new java.util.ArrayList (); 30 31 java.util.HashMap cldToNodes = new java.util.HashMap (); 32 33 34 public OjbMetaRootNode(org.apache.ojb.broker.metadata.DescriptorRepository pRepository, OjbMetaDataTreeModel model) 35 { 36 super(pRepository, model, null); 37 supportedActions.add(new org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel.actions.ActionAddClassDescriptor(this)); 38 } 39 40 public boolean getAllowsChildren () 41 { 42 return true; 43 } 44 45 public Class getPropertyEditorClass () 46 { 47 return null; 48 } 49 50 public boolean isLeaf () 51 { 52 return false; 53 } 54 55 57 public Object getAttribute (String strKey) 58 { 59 return null; 60 } 61 62 64 public void setAttribute (String strKey, Object value) 65 { 66 } 67 68 public OjbMetaClassDescriptorNode getClassDescriptorNodeForClassDescriptor(org.apache.ojb.broker.metadata.ClassDescriptor cld) 69 { 70 return (OjbMetaClassDescriptorNode)this.cldToNodes.get(cld); 71 } 72 73 77 protected boolean _load () 78 { 79 java.util.Iterator it = 80 this.getOjbMetaTreeModel ().getRepository().iterator(); 81 java.util.ArrayList newChildren = new java.util.ArrayList (); 82 83 84 85 91 while (it.hasNext()) 92 { 93 org.apache.ojb.broker.metadata.ClassDescriptor cld = (org.apache.ojb.broker.metadata.ClassDescriptor)it.next(); 94 OjbMetaClassDescriptorNode cldNode = 95 new OjbMetaClassDescriptorNode(this.getOjbMetaTreeModel ().getRepository(), 96 this.getOjbMetaTreeModel (), 97 this, cld); 98 cldToNodes.put(cld, cldNode); 99 newChildren.add(cldNode); 100 } 101 java.util.Collections.sort(newChildren); 102 this.alChildren = newChildren; 103 this.getOjbMetaTreeModel ().nodeStructureChanged(this); 104 return true; 105 } 106 107 public void addClassDescriptor(org.apache.ojb.broker.metadata.ClassDescriptor cld) 108 { 109 OjbMetaClassDescriptorNode cldNode = 110 new OjbMetaClassDescriptorNode(this.getOjbMetaTreeModel ().getRepository(), 111 this.getOjbMetaTreeModel (), 112 this, cld); 113 cldToNodes.put(cld, cldNode); 114 this.alChildren.add(cldNode); 115 this.getOjbMetaTreeModel().nodesWereInserted(this, new int[]{this.alChildren.size()-1}); 116 } 117 118 121 public java.util.Iterator getActions() 122 { 123 return supportedActions.iterator(); 124 } 125 126 129 public boolean actionListCachable() 130 { 131 return true; 132 } 133 134 137 public boolean actionListStatic() 138 { 139 return false; 140 } 141 142 148 public Object getAssociatedDescriptor() 149 { 150 return null; 151 } 152 153 } 154 | Popular Tags |