1 15 16 package org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel; 17 18 import org.apache.ojb.tools.mapping.reversedb2.propertyEditors.EditableTreeNodeWithProperties; 19 import javax.swing.tree.TreeNode ; 20 21 22 23 31 public abstract class OjbMetaTreeNode extends EditableTreeNodeWithProperties 32 implements Comparable , 33 org.apache.ojb.tools.mapping.reversedb2.ActionTarget 34 { 35 private OjbMetaTreeNode parent; 36 private org.apache.ojb.broker.metadata.DescriptorRepository repository; 37 private OjbMetaDataTreeModel treeModel; 38 protected java.util.ArrayList alChildren = new java.util.ArrayList (); 39 40 public OjbMetaTreeNode(org.apache.ojb.broker.metadata.DescriptorRepository pRepository, OjbMetaDataTreeModel pTreeModel, OjbMetaTreeNode pparent) 41 { 42 this.parent = pparent; 43 this.repository = pRepository; 44 this.treeModel = pTreeModel; 45 } 46 47 public org.apache.ojb.broker.metadata.DescriptorRepository getRepository() 48 { 49 return this.repository; 50 } 51 52 55 public TreeNode getChildAt(int index) 56 { 57 return (TreeNode )this.alChildren.get(index); 58 } 59 60 63 public int getChildCount() 64 { 65 return this.alChildren.size(); 66 } 67 68 71 public TreeNode getParent() 72 { 73 return this.parent; 74 } 75 76 79 public int getIndex(TreeNode o) 80 { 81 return this.alChildren.indexOf(o); 82 } 83 84 87 public abstract boolean getAllowsChildren(); 88 89 92 public abstract boolean isLeaf(); 93 94 97 public java.util.Enumeration children () 98 { 99 return java.util.Collections.enumeration(this.alChildren); 100 } 101 102 105 protected OjbMetaDataTreeModel getOjbMetaTreeModel() 106 { 107 return treeModel; 108 } 109 110 115 protected abstract boolean _load(); 116 117 120 public boolean load() 121 { 122 _load(); 123 java.util.Iterator it = this.alChildren.iterator(); 124 while (it.hasNext()) 125 { 126 Object o = it.next(); 127 if (o instanceof OjbMetaTreeNode) ((OjbMetaTreeNode)o).load(); 128 } 129 return true; 130 } 131 132 135 public int compareTo(Object arg0) 136 { 137 return this.toString().compareTo(arg0.toString()); 138 } 139 140 145 public abstract Object getAssociatedDescriptor(); 146 147 } 148 | Popular Tags |