KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmfClientComponents > gui > VisualIpToMACAddress


1 package ist.coach.coachEmfClientComponents.gui;
2
3 import javax.swing.ImageIcon JavaDoc;
4
5 import intt.itu.itut_x780.ManagedObjectValueType;
6 import intt.itu.itut_x780.AdministrativeStateType;
7 import intt.itu.itut_x780.OperationalStateType;
8 import intt.itu.itut_x780.UsageStateType;
9 import ist.coach.coachEmsMib.IpToMACAddressValueType;
10 import ist.coach.coachEmfClientComponents.InvokeSetData;
11
12 import ist.coach.coachEmfCommon.Utils;
13 public class VisualIpToMACAddress
14 extends MOTreeObject {
15
16     static String JavaDoc[] subordinate_names = new String JavaDoc[0];
17 // static String[] subordinate_vtype = new String[0];
18

19         // HACK
20
// This must be the type declared in idl as objectClass!!!!!
21
static String JavaDoc object_type = "IpToMACAddress";
22     static String JavaDoc emsClassName = "ist.coach.coachEmsMib.IpToMACAddress_F";
23
24     static String JavaDoc DISPLAY_TYPE = "Logical Interface";
25     static boolean canRefresh = false;
26     //
27
// create arguments
28
//
29
static String JavaDoc[] create_arg_name = new String JavaDoc[0];
30     static String JavaDoc[] create_arg_editor = new String JavaDoc[0];
31     static String JavaDoc[] create_arg_renderer = new String JavaDoc[0];
32     //
33
// get/set arguments
34
//
35

36     static String JavaDoc[] attributes_name = { //ManagedObject
37
"Name",
38                                         "Element Type",
39                                         "Creation Source",
40                                         "Delete Policy",
41                                                 //IpToMACAddress
42
"Logical Interface Index",
43                                         "Media-dependent Physical Address",
44                                         "Corresponding IP Address",
45                                         "Type of Mapping",
46
47                     };
48
49     static boolean[] attributes_readonly = {
50                     false,
51                     false,
52                     false,
53                     false,
54                     false,
55                     false,
56                     false, //true,
57
false,
58
59     };
60
61
62 public VisualIpToMACAddress(String JavaDoc key) {
63
64     super(key);
65     leafIcon = new ImageIcon JavaDoc(VisualIpToMACAddress.class.getResource(
66                 "images/iptomacaddress_icon.gif"));
67     nodeIcon = new ImageIcon JavaDoc(VisualIpToMACAddress.class.getResource(
68                     "images/iptomacaddress_icon.gif"));
69     toolTipText = new String JavaDoc(DISPLAY_TYPE);
70
71
72 }
73
74     public Object JavaDoc[] translate_values(ManagedObjectValueType original_value_type) {
75
76         Object JavaDoc[] values = new Object JavaDoc[attributes_name.length];
77         for (int i = 0; i < values.length; i++)
78             values[i] = "unspecified";
79
80         if (original_value_type == null)
81             return values;
82
83         Object JavaDoc[] mo_values = super.translate_values(original_value_type);
84         int i = 0;
85         for (i = 0; i < mo_values.length; i++)
86             values[i] = mo_values[i];
87
88         IpToMACAddressValueType value_type;
89         value_type = (IpToMACAddressValueType) original_value_type;
90
91             //
92
// IpToMACAddress
93
//
94

95         if (value_type.ipNetToMediaIfIndex >= 0)
96           values[i] = String.valueOf(value_type.ipNetToMediaIfIndex);
97         i++;
98
99         if (value_type.ipNetToMediaPhysAddress != null &&
100                 value_type.ipNetToMediaPhysAddress.length > 0) {
101
102             //values[i] = new String(value_type.ifPhysAddress);
103

104             String JavaDoc hexAddressStr = new String JavaDoc();
105             String JavaDoc shortStr = new String JavaDoc();
106             for (int j = 0; j < value_type.ipNetToMediaPhysAddress.length; j++) {
107                 hexAddressStr += Integer.toHexString(
108                     new Byte JavaDoc((value_type.ipNetToMediaPhysAddress[j])).intValue() & 0x000000ff);
109
110                 if (j < value_type.ipNetToMediaPhysAddress.length - 1)
111                     hexAddressStr += ":";
112             }
113             values[i] = hexAddressStr;
114
115         }
116         i++;
117
118         if (value_type.ipNetToMediaNetAddress != null &&
119                 value_type.ipNetToMediaNetAddress.length > 0) {
120
121             values[i] = new String JavaDoc(value_type.ipNetToMediaNetAddress);
122         }
123         i++;
124
125         switch(value_type.ipNetToMediaType) {
126             case 1 :
127                   values[i] = "Other (neither invalid/dynamic/static)";
128                   break;
129             case 2 :
130                 values[i] = "invalid";
131                 break;
132             case 3 :
133                 values[i] = "dynamic";
134                 break;
135             case 4 :
136                     values[i] = "static";
137                     break;
138             default:
139                 values[i++] = new String JavaDoc("Unknown");
140         }
141         return values;
142     }
143
144     java.util.Vector JavaDoc translate_updates(java.util.Hashtable JavaDoc values) {
145           return new java.util.Vector JavaDoc();
146     }
147
148 }
149
Popular Tags