1 package ist.coach.coachEmfClientComponents.gui; 2 3 import javax.swing.ImageIcon ; 4 5 import intt.itu.itut_x780.ManagedObjectValueType; 6 import intt.itu.itut_x780.SourceIndicatorType; 7 import intt.itu.itut_x780.notDeletable; 8 import intt.itu.itut_x780.deleteOnlyIfNoContainedObjects; 9 import intt.itu.itut_x780.deleteContainedObjects; 10 11 public class MOTreeObject { 12 String key; 13 ImageIcon leafIcon, nodeIcon; 14 String toolTipText; 15 16 static String [] subordinate_names = { "ManagedObject", 17 "ManagedElement", 18 "IpNode"}; 19 static boolean canRefresh = false; 23 24 static String object_type = "ManagedObject"; 27 28 static String DISPLAY_TYPE = "ManagedObject"; 29 static String [] create_arg_name = {"Name"}; 33 static String [] create_arg_editor = { "", ""}; 34 static String [] create_arg_renderer = { "", ""}; 35 static String [] attributes_name = {"Name", 39 "Element Type", 40 "Creation Source", 41 "Delete Policy"}; 42 43 static boolean[] attributes_readonly = {false, false, false, false}; 44 private String label = null; 45 46 47 49 50 public MOTreeObject(String key) { 51 52 this.key = key; 53 leafIcon = new ImageIcon (MOTreeObject.class.getResource("images/managedobject_icon.gif")); 54 nodeIcon = new ImageIcon (MOTreeObject.class.getResource("images/managedobject_icon.gif")); 55 toolTipText = new String (DISPLAY_TYPE); 56 57 int objIndex = 0; 61 int lastIndex = key.lastIndexOf("/"); 62 63 if (lastIndex > 0) { 64 String object_id = key.substring(0, lastIndex); 65 if (object_id != null && object_id.length() > 0 && 66 (objIndex = object_id.lastIndexOf("/")) > 0) { 67 68 label = object_id.substring(objIndex+1); 69 } 70 else 71 label = key; 72 lastIndex =label.lastIndexOf("."); 73 if (lastIndex > 0) 74 label = label.substring(0, lastIndex); 75 } 76 else { 77 lastIndex = key.lastIndexOf("."); 78 if (lastIndex > 0) 79 label = key.substring(0, lastIndex); 80 else 81 label = key; 82 } 83 84 } 85 86 87 90 public String toString() { 91 return label; 92 } 93 94 public String key() { 95 return key; 96 } 97 98 public Object [] translate_values(ManagedObjectValueType value_type) { 99 100 Object [] values = new Object [attributes_name.length]; 101 for(int i = 0; i < values.length; i++) 102 values[i] = "unspecified"; 103 104 if (value_type == null) 105 return values; 106 107 String name_str = new String (); 108 if (value_type.name != null && value_type.name.length > 0) { 109 for (int i = 0; i < value_type.name.length; i++) { 110 name_str = name_str.concat(value_type.name[i].id 111 + "." + value_type.name[i].kind); 112 113 if (i < value_type.name.length -1 ) { 114 name_str = name_str.concat("/"); 115 } 116 } 117 } 118 else 119 GuiClient.println("name value retrieved is null"); 120 121 values[0] = new String (name_str); 122 values[1] = new String (value_type.objectClass); 123 switch(value_type.creationSource.value()) { 124 case SourceIndicatorType._resourceOperation : 125 values[2] = new String ("System Created"); 126 break; 127 case SourceIndicatorType._managementOperation : 128 values[2] = new String ("Manager Created"); 129 break; 130 default: 131 values[2] = new String ("Unknown"); 132 } 133 switch(value_type.deletePolicy) { 134 case intt.itu.itut_x780.notDeletable.value: 135 values[3] = new String ("Not Deletable"); 136 break; 137 case intt.itu.itut_x780.deleteOnlyIfNoContainedObjects.value: 138 values[3] = new String ("Delete only if zero contained objects"); 139 break; 140 case intt.itu.itut_x780.deleteContainedObjects.value: 141 values[3] = new String ("Remove will also remove subordinate objects"); 142 break; 143 } 144 145 return values; 146 } 147 148 java.util.Vector translate_updates(java.util.Hashtable values) { 149 150 System.err.println("Translate has been called on MOTreeObject!"); 151 return new java.util.Vector (); 152 } 153 } 154 | Popular Tags |