1 package org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel; 2 3 import org.apache.ojb.broker.metadata.ClassDescriptor; 4 import org.apache.ojb.broker.metadata.DescriptorRepository; 5 import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor; 6 7 public class OjbMetaObjectReferenceDescriptorNode extends OjbMetaTreeNode 8 { 9 10 private static java.util.ArrayList supportedActions = new java.util.ArrayList (); 11 12 private ObjectReferenceDescriptor objRefDescriptor; 13 27 public OjbMetaObjectReferenceDescriptorNode( 28 DescriptorRepository pRepository, 29 OjbMetaDataTreeModel pTreeModel, 30 OjbMetaTreeNode pparent, 31 ObjectReferenceDescriptor pObjRefDescriptor) 32 { 33 super(pRepository, pTreeModel, pparent); 34 this.objRefDescriptor = pObjRefDescriptor; 35 } 36 37 40 protected boolean _load() 41 { 42 java.util.ArrayList newChildren = new java.util.ArrayList (); 43 ClassDescriptor itemClass = this.getRepository().getDescriptorFor(this.objRefDescriptor.getItemClassName()); 44 newChildren.add(getOjbMetaTreeModel().getClassDescriptorNodeForClassDescriptor(itemClass)); 45 this.alChildren = newChildren; 46 47 java.util.Iterator it; 48 49 try 51 { 52 53 it = objRefDescriptor.getForeignKeyFields().iterator(); 54 while (it.hasNext()) 55 newChildren.add(new javax.swing.tree.DefaultMutableTreeNode ("FkFields: " + it.next().toString())); 56 } 57 catch (NullPointerException npe) 58 { 59 npe.printStackTrace(); 60 } 61 62 63 this.getOjbMetaTreeModel().nodeStructureChanged(this); 64 return true; 65 } 66 67 71 public boolean load() 72 { 73 return _load(); 74 } 75 76 79 public boolean isLeaf() 80 { 81 return false; 82 } 83 84 87 public boolean getAllowsChildren() 88 { 89 return false; 90 } 91 92 95 public void setAttribute(String strKey, Object value) 96 { 97 } 98 99 102 public Object getAttribute(String strKey) 103 { 104 return null; 105 } 106 107 110 public Class getPropertyEditorClass() 111 { 112 return null; 113 } 114 115 public String toString() 116 { 117 if (objRefDescriptor.getItemClassName() != null) 118 return "ObjectReferenceDescriptor: " + objRefDescriptor.getItemClassName(); 119 else 120 return "ObjectReference: .getItemClass() == null"; 121 } 122 123 126 public java.util.Iterator getActions() 127 { 128 return supportedActions.iterator(); 129 } 130 131 134 public boolean actionListCachable() 135 { 136 return true; 137 } 138 139 public boolean actionListStatic() 140 { 141 return true; 142 } 143 144 149 public Object getAssociatedDescriptor() 150 { 151 return objRefDescriptor; 152 } 153 154 } 155 156 | Popular Tags |