1 21 package org.jacorb.ir.gui.remoteobject; 22 23 24 25 import org.jacorb.ir.gui.typesystem.*; 26 27 import org.jacorb.ir.gui.typesystem.remote.*; 28 29 import javax.swing.tree.*; 30 31 import org.jacorb.ir.gui.typesystem.*; 32 33 34 35 42 43 44 45 public class ObjectRepresentant extends ModelParticipant 46 47 { 48 49 protected Object counterPart; 50 51 53 protected String name; 54 55 protected TypeSystemNode typeSystemNode; 56 57 58 59 60 61 62 63 70 71 protected ObjectRepresentant (Object counterPart, TypeSystemNode type, String name) { 72 73 this.counterPart = counterPart; 74 75 if (name!=null) { 76 77 setName(name); 78 79 } 80 81 else { 82 83 setName("this"); 84 85 } 86 87 typeSystemNode = type; 88 89 System.out.println(this+" value: "+value()); 90 91 } 92 93 102 103 public int compareTo(ModelParticipant other) { 104 105 return this.toString().compareTo(other.toString()); 106 107 } 108 109 116 117 public TreeModel getTreeModel() { 118 119 return ModelBuilder.getSingleton().buildTreeModelAsync(this); 120 121 } 122 123 130 131 public TypeSystemNode getTypeSystemNode() { 132 133 return typeSystemNode; 134 135 } 136 137 144 145 protected void setName(String name) { 146 147 this.name = name; 148 149 } 150 151 158 159 public String toString() { 160 161 if (typeSystemNode!=null) { 163 return typeSystemNode.getAbsoluteName() + " " + name; 164 165 } 166 167 else { 168 169 return name; 170 171 } 172 173 } 174 175 182 183 public String value() { 184 185 if (counterPart!=null) { 186 187 return counterPart.toString(); 188 189 } 190 191 else { 192 193 return "nil"; 194 195 } 196 197 } 198 199 } 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | Popular Tags |